WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
80923
Web Inspector: CodeGeneratorInspector.py: refactor copy-paste getter methods
https://bugs.webkit.org/show_bug.cgi?id=80923
Summary
Web Inspector: CodeGeneratorInspector.py: refactor copy-paste getter methods
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
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Peter Rybin
Comment 1
2012-03-12 18:47:35 PDT
Created
attachment 131486
[details]
Patch
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.
Top of Page
Format For Printing
XML
Clone This Bug