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

Unified Diff: samples/process.cc

Issue 15837007: remove use of context scope with persistent argument (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « samples/lineprocessor.cc ('k') | src/d8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/process.cc
diff --git a/samples/process.cc b/samples/process.cc
index fd3a82163904b376dc60a24a08298ff1c7a32a22..8a41faec9b5afc21c867c3630c3723b66c1f0099 100644
--- a/samples/process.cc
+++ b/samples/process.cc
@@ -168,11 +168,12 @@ bool JsHttpRequestProcessor::Initialize(map<string, string>* opts,
// is what we need for the reference to remain after we return from
// this method. That persistent handle has to be disposed in the
// destructor.
- context_.Reset(GetIsolate(), Context::New(GetIsolate(), NULL, global));
+ v8::Handle<v8::Context> context = Context::New(GetIsolate(), NULL, global);
+ context_.Reset(GetIsolate(), context);
// Enter the new context so all the following operations take place
// within it.
- Context::Scope context_scope(GetIsolate(), context_);
+ Context::Scope context_scope(context);
// Make the options mapping available within the context
if (!InstallMaps(opts, output))
@@ -253,9 +254,12 @@ bool JsHttpRequestProcessor::Process(HttpRequest* request) {
// Create a handle scope to keep the temporary object references.
HandleScope handle_scope(GetIsolate());
+ v8::Local<v8::Context> context =
+ v8::Local<v8::Context>::New(GetIsolate(), context_);
+
// Enter this processor's context so all the remaining operations
// take place there
- Context::Scope context_scope(GetIsolate(), context_);
+ Context::Scope context_scope(context);
// Wrap the C++ request object in a JavaScript wrapper
Handle<Object> request_obj = WrapRequest(request);
« no previous file with comments | « samples/lineprocessor.cc ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698