[Webkit-unassigned] [Bug 80923] Web Inspector: CodeGeneratorInspector.py: refactor copy-paste getter methods

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 13 01:02:24 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=80923





--- Comment #2 from Ilya Tikhonovsky <loislo at chromium.org>  2012-03-13 01:02:24 PST ---
(From update of attachment 131486)
View in context: https://bugs.webkit.org/attachment.cgi?id=131486&action=review

> Source/WebCore/inspector/CodeGeneratorInspector.py:2030
> +struct AsMethodBridges {
> +    static bool asInt(InspectorValue* value, int* output) { return value->asNumber(output); }
> +    static bool asString(InspectorValue* value, String* output) { return value->asString(output); }
> +    static bool asBoolean(InspectorValue* value, bool* output) { return value->asBoolean(output); }
> +    static bool asObject(InspectorValue* value, RefPtr<InspectorObject>* output) { return value->asObject(output); }
> +    static bool asArray(InspectorValue* value, RefPtr<InspectorArray>* output) { return value->asArray(output); }
> +};

Looks like you can use function overloading here or template with specialization.
As result it would be possible to drop as_method argument from getPropertyValueImpl.

> Source/WebCore/inspector/CodeGeneratorInspector.py:2036
> +int InspectorBackendDispatcherImpl::getInt(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
> +{
> +    return getPropertyValueImpl<int, int, int>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInt, "Number");
> +}
>  

inline it?

> Source/WebCore/inspector/CodeGeneratorInspector.py:2039
> +String InspectorBackendDispatcherImpl::getString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
> +{
> +    return getPropertyValueImpl<String, String, String>(object, name, valueFound, protocolErrors, "", AsMethodBridges::asString, "String");

ditto

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list