Bug 80923

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 Flags
Patch none

Peter Rybin
Reported 2012-03-12 18:35:24 PDT
Generator contains several very similar getter methods for InspectorBackendDispatcher.cpp file. Combine them into one method.
Attachments
Patch (10.83 KB, patch)
2012-03-12 18:47 PDT, Peter Rybin
no flags
Peter Rybin
Comment 1 2012-03-12 18:47:35 PDT
Ilya Tikhonovsky
Comment 2 2012-03-13 01:02:24 PDT
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
Yury Semikhatsky
Comment 3 2012-03-13 01:57:32 PDT
Comment on attachment 131486 [details] Patch Please address Ilya's comments before landing.
WebKit Review Bot
Comment 4 2012-03-13 09:04:02 PDT
Comment on attachment 131486 [details] Patch Clearing flags on attachment: 131486 Committed r110572: <http://trac.webkit.org/changeset/110572>
WebKit Review Bot
Comment 5 2012-03-13 09:04:07 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.