Introduce explicit constant for per Context debug data set by embedder

It's value is hardwired in gin[1] and is referenced in Blink[2]. Since it is treated specially by v8 debugger it should be defined in v8 API and referenced in gin and blink..

[1] https://src.chromium.org/viewvc/chrome/trunk/src/gin/public/context_holder.h?r1=239099&r2=239098&pathrev=239099
[2] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp&q=kDebugIdIndex%20f:V8PerContextData&sq=package:chromium&type=cs

BUG=chromium:466631
LOG=Y

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

Cr-Commit-Position: refs/heads/master@{#27290}
This commit is contained in:
yurys 2015-03-19 01:18:35 -07:00 committed by Commit bot
parent 35c3d47e88
commit c622cb637a
2 changed files with 8 additions and 1 deletions

View File

@ -6287,6 +6287,13 @@ class V8_EXPORT Context {
/** Returns an isolate associated with a current context. */
v8::Isolate* GetIsolate();
/**
* The field at kDebugIdIndex is reserved for V8 debugger implementation.
* The value is propagated to the scripts compiled in given Context and
* can be used for filtering scripts.
*/
enum EmbedderDataFields { kDebugIdIndex = 0 };
/**
* Gets the embedder data with the given index, which must have been set by a
* previous call to SetEmbedderData with the same index. Note that index 0

View File

@ -1059,7 +1059,7 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
// TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile?
FixedArray* array = isolate->native_context()->embedder_data();
script->set_context_data(array->get(0));
script->set_context_data(array->get(v8::Context::kDebugIdIndex));
isolate->debug()->OnBeforeCompile(script);