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

Unified Diff: src/api.cc

Issue 109013: Add the ability to set embedder data on created contexts from the API (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 8 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
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
===================================================================
--- src/api.cc (revision 1851)
+++ src/api.cc (working copy)
@@ -445,6 +445,40 @@
}
+void Context::SetData(v8::Handle<Value> data) {
+ if (IsDeadCheck("v8::Context::SetData()")) return;
+ ENTER_V8;
+ {
+ HandleScope scope;
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
+ i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
+ ASSERT(env->IsGlobalContext());
+ if (env->IsGlobalContext()) {
+ env->set_data(*raw_data);
+ }
+ }
+}
+
+
+v8::Local<v8::Value> Context::GetData() {
+ if (IsDeadCheck("v8::Context::GetData()")) return v8::Local<Value>();
+ ENTER_V8;
+ i::Object* raw_result = NULL;
+ {
+ HandleScope scope;
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
+ ASSERT(env->IsGlobalContext());
+ if (env->IsGlobalContext()) {
+ raw_result = env->data();
+ } else {
+ return Local<Value>();
+ }
+ }
+ i::Handle<i::Object> result(raw_result);
+ return Utils::ToLocal(result);
+}
+
+
void** v8::HandleScope::RawClose(void** value) {
if (!ApiCheck(!is_closed_,
"v8::HandleScope::Close()",
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698