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

Side by Side Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 1097273002: Refactor core/v8/* methods to take isolate as first parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 if (info.Length() < 1 || !info[0]->IsObject()) 280 if (info.Length() < 1 || !info[0]->IsObject())
281 return; 281 return;
282 282
283 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(info[0]); 283 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(info[0]);
284 284
285 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); 285 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder());
286 ScriptDebugServer& debugServer = host->scriptDebugServer(); 286 ScriptDebugServer& debugServer = host->scriptDebugServer();
287 v8SetReturnValue(info, debugServer.getInternalProperties(object)); 287 v8SetReturnValue(info, debugServer.getInternalProperties(object));
288 } 288 }
289 289
290 static v8::Local<v8::Array> getJSListenerFunctions(ExecutionContext* executionCo ntext, const EventListenerInfo& listenerInfo, v8::Isolate* isolate) 290 static v8::Local<v8::Array> getJSListenerFunctions(v8::Isolate* isolate, Executi onContext* executionContext, const EventListenerInfo& listenerInfo)
291 { 291 {
292 v8::Local<v8::Array> result = v8::Array::New(isolate); 292 v8::Local<v8::Array> result = v8::Array::New(isolate);
293 size_t handlersCount = listenerInfo.eventListenerVector.size(); 293 size_t handlersCount = listenerInfo.eventListenerVector.size();
294 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) { 294 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) {
295 RefPtr<EventListener> listener = listenerInfo.eventListenerVector[i].lis tener; 295 RefPtr<EventListener> listener = listenerInfo.eventListenerVector[i].lis tener;
296 if (listener->type() != EventListener::JSEventListenerType) { 296 if (listener->type() != EventListener::JSEventListenerType) {
297 ASSERT_NOT_REACHED(); 297 ASSERT_NOT_REACHED();
298 continue; 298 continue;
299 } 299 }
300 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListene r*>(listener.get()); 300 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListene r*>(listener.get());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 if (!target || !target->executionContext()) 335 if (!target || !target->executionContext())
336 return; 336 return;
337 337
338 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); 338 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder());
339 Vector<EventListenerInfo> listenersArray; 339 Vector<EventListenerInfo> listenersArray;
340 host->getEventListenersImpl(target, listenersArray); 340 host->getEventListenersImpl(target, listenersArray);
341 341
342 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); 342 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate());
343 for (size_t i = 0; i < listenersArray.size(); ++i) { 343 for (size_t i = 0; i < listenersArray.size(); ++i) {
344 v8::Local<v8::Array> listeners = getJSListenerFunctions(target->executio nContext(), listenersArray[i], info.GetIsolate()); 344 v8::Local<v8::Array> listeners = getJSListenerFunctions(info.GetIsolate( ), target->executionContext(), listenersArray[i]);
345 if (!listeners->Length()) 345 if (!listeners->Length())
346 continue; 346 continue;
347 AtomicString eventType = listenersArray[i].eventType; 347 AtomicString eventType = listenersArray[i].eventType;
348 result->Set(v8String(info.GetIsolate(), eventType), listeners); 348 result->Set(v8String(info.GetIsolate(), eventType), listeners);
349 } 349 }
350 350
351 v8SetReturnValue(info, result); 351 v8SetReturnValue(info, result);
352 } 352 }
353 353
354 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& info) 354 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& info)
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder()); 601 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder());
602 if (!injectedScriptNative) 602 if (!injectedScriptNative)
603 return; 603 return;
604 int id = info[0].As<v8::Int32>()->Value(); 604 int id = info[0].As<v8::Int32>()->Value();
605 String groupName = injectedScriptNative->groupName(id); 605 String groupName = injectedScriptNative->groupName(id);
606 if (!groupName.isEmpty()) 606 if (!groupName.isEmpty())
607 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName)); 607 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName));
608 } 608 }
609 609
610 } // namespace blink 610 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp ('k') | Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698