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

Unified Diff: src/api.cc

Issue 10907189: Let the embedder store arbitrary Values via Context::SetData (Closed) Base URL: http://git.chromium.org/external/v8.git@master
Patch Set: Created 8 years, 3 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
« include/v8.h ('K') | « include/v8.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8b323b2f1fb7264f3b8da49cf1c491ec33c06742..df8fa14e4fd40a44ff0ef7a6d213ef5617046db4 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -763,7 +763,7 @@ void Context::Exit() {
}
-void Context::SetData(v8::Handle<String> data) {
+void Context::SetData(v8::Handle<Value> data) {
i::Handle<i::Context> env = Utils::OpenHandle(this);
i::Isolate* isolate = env->GetIsolate();
if (IsDeadCheck(isolate, "v8::Context::SetData()")) return;
@@ -779,16 +779,13 @@ v8::Local<v8::Value> Context::GetData() {
i::Handle<i::Context> env = Utils::OpenHandle(this);
i::Isolate* isolate = env->GetIsolate();
if (IsDeadCheck(isolate, "v8::Context::GetData()")) {
- return v8::Local<Value>();
+ return Local<Value>();
}
- i::Object* raw_result = NULL;
ASSERT(env->IsNativeContext());
- if (env->IsNativeContext()) {
- raw_result = env->data();
- } else {
+ if (!env->IsNativeContext()) {
Sven Panne 2012/09/13 07:39:28 I see that this has been here before, but it looks
danno 2012/09/14 13:15:14 It's probably outside of the scope of this CL to f
return Local<Value>();
}
- i::Handle<i::Object> result(raw_result, isolate);
+ i::Handle<i::Object> result(env->data(), isolate);
return Utils::ToLocal(result);
}
« include/v8.h ('K') | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698