Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp

Issue 1779033003: DevTools: always use 16bit strings for inspector protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
index 84867dce9525f9bb9fbb28144313b575ac837102..7b34592bf8ded7dba909f530b2be50ff41c118f5 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
@@ -89,7 +89,7 @@ PassOwnPtrWillBeRawPtr<InspectorDOMDebuggerAgent> InspectorDOMDebuggerAgent::cre
return adoptPtrWillBeNoop(new InspectorDOMDebuggerAgent(isolate, domAgent, runtimeAgent, debuggerAgent));
}
-void InspectorDOMDebuggerAgent::eventListenersInfoForTarget(v8::Isolate* isolate, v8::Local<v8::Value> value, V8EventListenerInfoMap& eventInformation)
+void InspectorDOMDebuggerAgent::eventListenersInfoForTarget(v8::Isolate* isolate, v8::Local<v8::Value> value, V8EventListenerInfoList& eventInformation)
{
EventTarget* target = V8EventTarget::toImplWithTypeCheck(isolate, value);
// We need to handle LocalDOMWindow specially, because LocalDOMWindow wrapper exists on prototype chain.
@@ -122,9 +122,7 @@ void InspectorDOMDebuggerAgent::eventListenersInfoForTarget(v8::Isolate* isolate
v8::Local<v8::Object> handler = v8Listener->getListenerObject(executionContext);
if (handler.IsEmpty())
continue;
- if (!eventInformation.get(type))
- eventInformation.set(type, adoptPtr(new protocol::Vector<V8EventListenerInfo>()));
- eventInformation.get(type)->append(V8EventListenerInfo(type, listeners->at(k).useCapture, handler));
+ eventInformation.append(V8EventListenerInfo(type, listeners->at(k).useCapture, handler));
}
}
}
@@ -373,23 +371,21 @@ void InspectorDOMDebuggerAgent::getEventListeners(ErrorString* errorString, cons
void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v8::Local<v8::Value> object, const String16& objectGroup, protocol::Array<protocol::DOMDebugger::EventListener>* listenersArray)
{
- V8EventListenerInfoMap eventInformation;
+ V8EventListenerInfoList eventInformation;
InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate(), object, eventInformation);
- for (const auto& it : eventInformation) {
- for (const auto& it2 : *it.second) {
- if (!it2.useCapture)
- continue;
- OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildObjectForEventListener(context, it2, objectGroup);
- if (listenerObject)
- listenersArray->addItem(listenerObject.release());
- }
- for (auto& it2 : *it.second) {
- if (it2.useCapture)
- continue;
- OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildObjectForEventListener(context, it2, objectGroup);
- if (listenerObject)
- listenersArray->addItem(listenerObject.release());
- }
+ for (const auto& info : eventInformation) {
+ if (!info.useCapture)
+ continue;
+ OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildObjectForEventListener(context, info, objectGroup);
+ if (listenerObject)
+ listenersArray->addItem(listenerObject.release());
+ }
+ for (const auto& info : eventInformation) {
+ if (info.useCapture)
+ continue;
+ OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildObjectForEventListener(context, info, objectGroup);
+ if (listenerObject)
+ listenersArray->addItem(listenerObject.release());
}
}

Powered by Google App Engine
This is Rietveld 408576698