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

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

Issue 2087953004: Switch v8 inspector to stl collections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/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 dc45b11875ec863bec1b1723311002cc743e717e..c7a783af8dc6a56574d6c5a6459e85888ff4ec33 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
@@ -295,7 +295,7 @@ void V8RuntimeAgentImpl::compileScript(ErrorString* errorString,
String16 scriptValueId = String16::number(script->GetUnboundScript()->GetId());
std::unique_ptr<v8::Global<v8::Script>> global(new v8::Global<v8::Script>(m_debugger->isolate(), script));
- m_compiledScripts.set(scriptValueId, std::move(global));
+ m_compiledScripts[scriptValueId] = std::move(global);
*scriptId = scriptValueId;
}
@@ -313,7 +313,8 @@ void V8RuntimeAgentImpl::runScript(ErrorString* errorString,
return;
}
- if (!m_compiledScripts.contains(scriptId)) {
+ auto it = m_compiledScripts.find(scriptId);
+ if (it == m_compiledScripts.end()) {
*errorString = "Script execution failed";
return;
}
@@ -325,7 +326,8 @@ void V8RuntimeAgentImpl::runScript(ErrorString* errorString,
if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false))
scope.ignoreExceptionsAndMuteConsole();
- std::unique_ptr<v8::Global<v8::Script>> scriptWrapper = m_compiledScripts.take(scriptId);
+ std::unique_ptr<v8::Global<v8::Script>> scriptWrapper = std::move(it->second);
+ m_compiledScripts.erase(it);
v8::Local<v8::Script> script = scriptWrapper->Get(m_debugger->isolate());
if (script.IsEmpty()) {
*errorString = "Script execution failed";

Powered by Google App Engine
This is Rietveld 408576698