WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 124374
Web Inspector: Simply generated domain dispatch methods for domains with few commands
https://bugs.webkit.org/show_bug.cgi?id=124374
Summary
Web Inspector: Simply generated domain dispatch methods for domains with few ...
Joseph Pecoraro
Reported
2013-11-14 12:07:59 PST
A bunch of domains have only a few methods. The hash lookup does not make sense. Turn: void InspectorInspectorBackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message) { Ref<InspectorInspectorBackendDispatcher> protect(*this); typedef void (InspectorInspectorBackendDispatcher::*CallHandler)(long callId, const InspectorObject& message); typedef HashMap<String, CallHandler> DispatchMap; DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ()); if (dispatchMap.isEmpty()) { static const struct MethodTable { const char* name; CallHandler handler; } commands[] = { { "enable", &InspectorInspectorBackendDispatcher::enable }, { "disable", &InspectorInspectorBackendDispatcher::disable }, }; size_t length = WTF_ARRAY_LENGTH(commands); for (size_t i = 0; i < length; ++i) dispatchMap.add(commands[i].name, commands[i].handler); } HashMap<String, CallHandler>::iterator it = dispatchMap.find(method); if (it == dispatchMap.end()) { m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, String("'") + "Inspector" + '.' + method + "' was not found"); return; } ((*this).*it->value)(callId, *message.get()); } into: void InspectorInspectorBackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message) { Ref<InspectorInspectorBackendDispatcher> protect(*this); if (method == "enable") enable(callId, *message.get()); else if (method == "disable") disable(callId, *message.get()); else m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, String("'") + "Inspector" + '.' + method + "' was not found"); }
Attachments
[PATCH] Proposed Fix
(6.41 KB, patch)
2013-11-14 12:20 PST
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2013-11-14 12:08:30 PST
<
rdar://problem/15472278
>
Joseph Pecoraro
Comment 2
2013-11-14 12:20:03 PST
Created
attachment 216967
[details]
[PATCH] Proposed Fix
WebKit Commit Bot
Comment 3
2013-11-14 13:28:37 PST
Comment on
attachment 216967
[details]
[PATCH] Proposed Fix Clearing flags on attachment: 216967 Committed
r159308
: <
http://trac.webkit.org/changeset/159308
>
WebKit Commit Bot
Comment 4
2013-11-14 13:28:38 PST
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