summaryrefslogtreecommitdiffstats
path: root/src/api.cc
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2010-03-29 12:03:09 +0100
committerAndrei Popescu <andreip@google.com>2010-03-29 12:03:09 +0100
commit74b3c146906ea120f97974b0e16aec75c17ebf66 (patch)
tree529f5893bf30271b7123fa94822c28131bd3bda1 /src/api.cc
parent144045c95df339bcbcf35374401289e1eefc1d85 (diff)
downloadandroid_external_v8-74b3c146906ea120f97974b0e16aec75c17ebf66.tar.gz
android_external_v8-74b3c146906ea120f97974b0e16aec75c17ebf66.tar.bz2
android_external_v8-74b3c146906ea120f97974b0e16aec75c17ebf66.zip
Cherry pick http://codereview.chromium.org/1207003/show
Implement support for reattaching a global object to a context. This can be used to use the same global object for different contexts at different points in time. Needed to fix b: 2533219 Change-Id: Ib3b0d35f6ce3e0a5f4b8e54561ba2e99a9ab0ab1
Diffstat (limited to 'src/api.cc')
-rw-r--r--src/api.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/api.cc b/src/api.cc
index 262bf528..22c5b77b 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3007,6 +3007,16 @@ void Context::DetachGlobal() {
}
+void Context::ReattachGlobal(Handle<Object> global_object) {
+ if (IsDeadCheck("v8::Context::ReattachGlobal()")) return;
+ ENTER_V8;
+ i::Object** ctx = reinterpret_cast<i::Object**>(this);
+ i::Handle<i::Context> context =
+ i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
+ i::Bootstrapper::ReattachGlobal(context, Utils::OpenHandle(*global_object));
+}
+
+
Local<v8::Object> ObjectTemplate::NewInstance() {
ON_BAILOUT("v8::ObjectTemplate::NewInstance()", return Local<v8::Object>());
LOG_API("ObjectTemplate::NewInstance");