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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp

Issue 1877203004: [DevTools] Follow up with cleanups for InjectedScript::Scope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ASSERT Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
index cf359432dd797a1769d1d07765dfac7f80b20eb8..d1b70a436e7ba1e442c8cf3ee3525cfa0b5cb483 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
@@ -31,10 +31,8 @@
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/inspector_protocol/Values.h"
-#include "platform/v8_inspector/IgnoreExceptionsScope.h"
#include "platform/v8_inspector/InjectedScript.h"
#include "platform/v8_inspector/InspectedContext.h"
-#include "platform/v8_inspector/MuteConsoleScope.h"
#include "platform/v8_inspector/RemoteObjectId.h"
#include "platform/v8_inspector/V8DebuggerImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
@@ -99,15 +97,11 @@ void V8RuntimeAgentImpl::evaluate(
if (!scope.initialize())
return;
- IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
- MuteConsoleScope muteConsoleScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
+ if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
+ scope.ignoreExceptionsAndMuteConsole();
- if (includeCommandLineAPI.fromMaybe(false)) {
- v8::MaybeLocal<v8::Object> commandLineAPI = scope.injectedScript()->commandLineAPI(errorString);
- if (commandLineAPI.IsEmpty())
- return;
- scope.installGlobalObjectExtension(commandLineAPI);
- }
+ if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI())
+ return;
bool evalIsDisabled = !scope.context()->IsCodeGenerationFromStringsAllowed();
// Temporarily enable allow evals for inspector.
@@ -160,8 +154,8 @@ void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
}
}
- IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
- MuteConsoleScope muteConsoleScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
+ if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
+ scope.ignoreExceptionsAndMuteConsole();
v8::MaybeLocal<v8::Value> maybeFunctionValue = m_debugger->compileAndRunInternalScript(scope.context(), toV8String(m_debugger->isolate(), "(" + expression + ")"));
// Re-initialize after running client's code, as it could have destroyed context or session.
@@ -179,10 +173,8 @@ void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
return;
}
- v8::MaybeLocal<v8::Object> remoteObjectAPI = scope.injectedScript()->remoteObjectAPI(errorString, scope.objectGroupName());
- if (remoteObjectAPI.IsEmpty())
+ if (!scope.installRemoteObjectAPI(scope.objectGroupName()))
return;
- scope.installGlobalObjectExtension(remoteObjectAPI);
v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->callFunction(functionValue.As<v8::Function>(), scope.context(), scope.object(), argc, argv.get());
// Re-initialize after running client's code, as it could have destroyed context or session.
@@ -208,9 +200,7 @@ void V8RuntimeAgentImpl::getProperties(
if (!scope.initialize())
return;
- IgnoreExceptionsScope ignoreExceptionsScope(m_debugger);
- MuteConsoleScope muteConsoleScope(m_debugger);
-
+ scope.ignoreExceptionsAndMuteConsole();
if (!scope.object()->IsObject()) {
*errorString = "Value with given id is not an object";
return;
@@ -335,8 +325,8 @@ void V8RuntimeAgentImpl::runScript(ErrorString* errorString,
if (!scope.initialize())
return;
- IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
- MuteConsoleScope muteConsoleScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
+ if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
+ scope.ignoreExceptionsAndMuteConsole();
OwnPtr<v8::Global<v8::Script>> scriptWrapper = m_compiledScripts.take(scriptId);
v8::Local<v8::Script> script = scriptWrapper->Get(m_debugger->isolate());
@@ -345,12 +335,8 @@ void V8RuntimeAgentImpl::runScript(ErrorString* errorString,
return;
}
- if (includeCommandLineAPI.fromMaybe(false)) {
- v8::MaybeLocal<v8::Object> commandLineAPI = scope.injectedScript()->commandLineAPI(errorString);
- if (commandLineAPI.IsEmpty())
- return;
- scope.installGlobalObjectExtension(commandLineAPI);
- }
+ if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI())
+ return;
v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->runCompiledScript(scope.context(), script);
« no previous file with comments | « third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698