Summary: | Web Inspector: CodeGeneratorInspector.py: refactor copy-paste getter methods | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Peter Rybin <prybin> | ||||
Component: | Web Inspector (Deprecated) | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, webkit.review.bot, yurys | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Attachments: |
|
Description
Peter Rybin
2012-03-12 18:35:24 PDT
Created attachment 131486 [details]
Patch
Comment on attachment 131486 [details] Patch 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 Comment on attachment 131486 [details]
Patch
Please address Ilya's comments before landing.
Comment on attachment 131486 [details] Patch Clearing flags on attachment: 131486 Committed r110572: <http://trac.webkit.org/changeset/110572> All reviewed patches have been landed. Closing bug. |