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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.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/platform/v8_inspector/V8InjectedScriptHost.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp
index 0f16980fe64a0e28d611dea2ad292aa6756c4976..18f453d8bf4072dade556fef772a7528c40ca6cd 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp
@@ -221,11 +221,13 @@ void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb
v8SetReturnValue(info, properties);
}
-static v8::Local<v8::Array> wrapListenerFunctions(v8::Isolate* isolate, const protocol::Vector<V8EventListenerInfo>& listeners)
+static v8::Local<v8::Array> wrapListenerFunctions(v8::Isolate* isolate, const V8EventListenerInfoList& listeners, const String16& type)
{
v8::Local<v8::Array> result = v8::Array::New(isolate);
size_t handlersCount = listeners.size();
for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) {
+ if (listeners[i].eventType != type)
+ continue;
v8::Local<v8::Object> function = listeners[i].handler;
v8::Local<v8::Object> listenerEntry = v8::Object::New(isolate);
listenerEntry->Set(toV8StringInternalized(isolate, "listener"), function);
@@ -244,16 +246,15 @@ void V8InjectedScriptHost::getEventListenersCallback(const v8::FunctionCallbackI
if (!host->debugger())
return;
V8DebuggerClient* client = host->debugger()->client();
- V8EventListenerInfoMap listenerInfo;
+ V8EventListenerInfoList listenerInfo;
client->eventListeners(info[0], listenerInfo);
v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate());
protocol::Vector<String16> types;
dgozman 2016/03/10 18:59:47 Should be a set now.
pfeldman 2016/03/10 23:30:10 Done.
- for (auto& it : listenerInfo)
- types.append(it.first);
- std::sort(types.begin(), types.end(), String16::codePointCompareLessThan);
+ for (auto& info : listenerInfo)
+ types.append(info.eventType);
for (const String16& type : types) {
- v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate(), *listenerInfo.get(type));
+ v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate(), listenerInfo, type);
if (!listeners->Length())
continue;
result->Set(toV8String(info.GetIsolate(), type), listeners);

Powered by Google App Engine
This is Rietveld 408576698