Commit ac19124b authored by pfeldman's avatar pfeldman Committed by Commit bot

DevTools: use atomicIncrement for the contextid counter (mind workers).

BUG=570113

Review URL: https://codereview.chromium.org/1552813002

Cr-Commit-Position: refs/heads/master@{#367197}
parent 3ff31966
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "core/inspector/v8/V8DebuggerClient.h" #include "core/inspector/v8/V8DebuggerClient.h"
#include "core/inspector/v8/V8JavaScriptCallFrame.h" #include "core/inspector/v8/V8JavaScriptCallFrame.h"
#include "platform/JSONValues.h" #include "platform/JSONValues.h"
#include "wtf/Atomics.h"
#include "wtf/Vector.h" #include "wtf/Vector.h"
#include "wtf/text/CString.h" #include "wtf/text/CString.h"
...@@ -46,6 +47,7 @@ namespace blink { ...@@ -46,6 +47,7 @@ namespace blink {
namespace { namespace {
const char stepIntoV8MethodName[] = "stepIntoStatement"; const char stepIntoV8MethodName[] = "stepIntoStatement";
const char stepOutV8MethodName[] = "stepOutOfFunction"; const char stepOutV8MethodName[] = "stepOutOfFunction";
volatile int s_lastContextId = 0;
} }
static bool inLiveEditScope = false; static bool inLiveEditScope = false;
...@@ -102,8 +104,7 @@ bool V8DebuggerImpl::enabled() const ...@@ -102,8 +104,7 @@ bool V8DebuggerImpl::enabled() const
void V8Debugger::setContextDebugData(v8::Local<v8::Context> context, const String& type, int contextGroupId) void V8Debugger::setContextDebugData(v8::Local<v8::Context> context, const String& type, int contextGroupId)
{ {
static int contextIdCounter = 0; int contextId = atomicIncrement(&s_lastContextId);
int contextId = ++contextIdCounter;
String debugData = String::number(contextGroupId) + "," + String::number(contextId) + "," + type; String debugData = String::number(contextGroupId) + "," + String::number(contextId) + "," + type;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
v8::Context::Scope contextScope(context); v8::Context::Scope contextScope(context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment