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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp

Issue 1992493002: [DevTools] Pass bindRemoteObject function to Custom Formatter directly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 findInjectedScript(session); 406 findInjectedScript(session);
407 if (!m_injectedScript) 407 if (!m_injectedScript)
408 return false; 408 return false;
409 m_context = m_injectedScript->context()->context(); 409 m_context = m_injectedScript->context()->context();
410 m_context->Enter(); 410 m_context->Enter();
411 return true; 411 return true;
412 } 412 }
413 413
414 bool InjectedScript::Scope::installCommandLineAPI() 414 bool InjectedScript::Scope::installCommandLineAPI()
415 { 415 {
416 ASSERT(m_injectedScript && !m_context.IsEmpty()); 416 DCHECK(m_injectedScript && !m_context.IsEmpty() && m_global.IsEmpty());
417 v8::Local<v8::Object> extensionObject; 417 v8::Local<v8::Object> extensionObject;
418 if (!m_injectedScript->commandLineAPI(m_errorString).ToLocal(&extensionObjec t)) 418 if (!m_injectedScript->commandLineAPI(m_errorString).ToLocal(&extensionObjec t))
419 return false; 419 return false;
420 return installGlobalObjectExtension(extensionObject); 420 m_extensionPrivate = V8Debugger::scopeExtensionPrivate(m_debugger->isolate() );
421 } 421 v8::Local<v8::Object> global = m_context->Global();
422 422 if (!global->SetPrivate(m_context, m_extensionPrivate, extensionObject).From Maybe(false)) {
423 bool InjectedScript::Scope::installRemoteObjectAPI(const String16& objectGroupNa me)
424 {
425 ASSERT(m_injectedScript && !m_context.IsEmpty());
426 V8FunctionCall function(m_debugger, m_context, m_injectedScript->v8Value(), "remoteObjectAPI");
427 function.appendArgument(objectGroupName);
428 bool hadException = false;
429 v8::Local<v8::Value> extension = function.call(hadException, false);
430 if (hadException || extension.IsEmpty() || !extension->IsObject()) {
431 *m_errorString = "Internal error"; 423 *m_errorString = "Internal error";
432 return false; 424 return false;
433 } 425 }
434 v8::Local<v8::Object> extensionObject = extension.As<v8::Object>();
435 return installGlobalObjectExtension(extensionObject);
436 }
437
438 bool InjectedScript::Scope::installGlobalObjectExtension(v8::Local<v8::Object> e xtension)
439 {
440 ASSERT(m_global.IsEmpty());
441 m_extensionPrivate = V8Debugger::scopeExtensionPrivate(m_debugger->isolate() );
442 v8::Local<v8::Object> global = m_context->Global();
443 if (!global->SetPrivate(m_context, m_extensionPrivate, extension).FromMaybe( false)) {
444 *m_errorString = "Internal error";
445 return false;
446 }
447 m_global = global; 426 m_global = global;
448 return true; 427 return true;
449 } 428 }
450 429
451 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() 430 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole()
452 { 431 {
453 ASSERT(!m_ignoreExceptionsAndMuteConsole); 432 ASSERT(!m_ignoreExceptionsAndMuteConsole);
454 m_ignoreExceptionsAndMuteConsole = true; 433 m_ignoreExceptionsAndMuteConsole = true;
455 m_debugger->client()->muteConsole(); 434 m_debugger->client()->muteConsole();
456 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl: :DontPauseOnExceptions); 435 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl: :DontPauseOnExceptions);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session) 529 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session)
551 { 530 {
552 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString, m_remoteCallFrameId); 531 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString, m_remoteCallFrameId);
553 if (!remoteId) 532 if (!remoteId)
554 return; 533 return;
555 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); 534 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
556 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() ); 535 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() );
557 } 536 }
558 537
559 } // namespace blink 538 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698