summaryrefslogtreecommitdiffstats
path: root/gin
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 01:51:17 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 01:51:17 +0000
commit36e3740818c9e7312dd62ad4c0131c2a54d95d8e (patch)
tree1c05dbb53edaa6794a7cc4ad6036d8a22b209865 /gin
parent0c142a64d093558991899ce1fadff5baf19b8c95 (diff)
downloadchromium_src-36e3740818c9e7312dd62ad4c0131c2a54d95d8e.zip
chromium_src-36e3740818c9e7312dd62ad4c0131c2a54d95d8e.tar.gz
chromium_src-36e3740818c9e7312dd62ad4c0131c2a54d95d8e.tar.bz2
[gin] move context_holder to public/
Also, define names for the embedder data slots on v8::Context that gin embedders should use. BUG=321631 R=abarth@chromium.org Review URL: https://codereview.chromium.org/104593007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin')
-rw-r--r--gin/context_holder.cc2
-rw-r--r--gin/gin.gyp2
-rw-r--r--gin/per_context_data.cc7
-rw-r--r--gin/public/context_holder.h (renamed from gin/context_holder.h)15
-rw-r--r--gin/runner.h2
5 files changed, 20 insertions, 8 deletions
diff --git a/gin/context_holder.cc b/gin/context_holder.cc
index 80c1198..32b5051 100644
--- a/gin/context_holder.cc
+++ b/gin/context_holder.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gin/context_holder.h"
+#include "gin/public/context_holder.h"
#include "base/logging.h"
#include "gin/per_context_data.h"
diff --git a/gin/gin.gyp b/gin/gin.gyp
index 172ed78..1f75469 100644
--- a/gin/gin.gyp
+++ b/gin/gin.gyp
@@ -24,7 +24,6 @@
'array_buffer.cc',
'array_buffer.h',
'context_holder.cc',
- 'context_holder.h',
'converter.cc',
'converter.h',
'dictionary.cc',
@@ -47,6 +46,7 @@
'per_context_data.h',
'per_isolate_data.cc',
'per_isolate_data.h',
+ 'public/context_holder.h',
'public/gin_embedders.h',
'public/isolate_holder.h',
'public/wrapper_info.h',
diff --git a/gin/per_context_data.cc b/gin/per_context_data.cc
index 666c414..5183d00 100644
--- a/gin/per_context_data.cc
+++ b/gin/per_context_data.cc
@@ -5,6 +5,7 @@
#include "gin/per_context_data.h"
#include "base/logging.h"
+#include "gin/public/context_holder.h"
#include "gin/public/wrapper_info.h"
namespace gin {
@@ -17,7 +18,8 @@ ContextSupplement::~ContextSupplement() {
PerContextData::PerContextData(v8::Handle<v8::Context> context)
: runner_(NULL) {
- context->SetAlignedPointerInEmbedderData(kEncodedValueIndex, this);
+ context->SetAlignedPointerInEmbedderData(
+ kPerContextDataStartIndex + kEmbedderNativeGin, this);
}
PerContextData::~PerContextData() {
@@ -26,7 +28,8 @@ PerContextData::~PerContextData() {
void PerContextData::Detach(v8::Handle<v8::Context> context) {
DCHECK(From(context) == this);
- context->SetAlignedPointerInEmbedderData(kEncodedValueIndex, NULL);
+ context->SetAlignedPointerInEmbedderData(
+ kPerContextDataStartIndex + kEmbedderNativeGin, NULL);
SuplementVector supplements;
supplements.swap(supplements_);
diff --git a/gin/context_holder.h b/gin/public/context_holder.h
index adb9d80..43b2822 100644
--- a/gin/context_holder.h
+++ b/gin/public/context_holder.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef GIN_CONTEXT_HOLDER_H_
-#define GIN_CONTEXT_HOLDER_H_
+#ifndef GIN_PUBLIC_CONTEXT_HOLDER_H_
+#define GIN_PUBLIC_CONTEXT_HOLDER_H_
#include <list>
@@ -13,6 +13,15 @@
namespace gin {
+// Gin embedder that store embedder data in v8::Contexts must do so in a
+// single field with the index kPerContextDataStartIndex + GinEmbedder-enum.
+// The field at kDebugIdIndex is treated specially by V8 and is reserved for
+// a V8 debugger implementation (not used by gin).
+enum ContextEmbedderDataFields {
+ kDebugIdIndex = 0,
+ kPerContextDataStartIndex,
+};
+
class PerContextData;
// ContextHolder is a generic class for holding a v8::Context. Rather than
@@ -41,4 +50,4 @@ class ContextHolder {
} // namespace gin
-#endif // GIN_CONTEXT_HOLDER_H_
+#endif // GIN_PUBLIC_CONTEXT_HOLDER_H_
diff --git a/gin/runner.h b/gin/runner.h
index cbebc76..8ba2b68 100644
--- a/gin/runner.h
+++ b/gin/runner.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "gin/context_holder.h"
+#include "gin/public/context_holder.h"
namespace gin {