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

Unified Diff: samples/process.cc

Issue 12033011: Add Isolate parameter to Persistent class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added explicit Created 7 years, 11 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') | samples/shell.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 ae6a5500cd1bb506dde593725189a3b0269315fa..c3d17738bf14348e9b10f97eb9baa23e8d752cd5 100644
--- a/samples/process.cc
+++ b/samples/process.cc
@@ -116,11 +116,13 @@ class JsHttpRequestProcessor : public HttpRequestProcessor {
// Utility methods for wrapping C++ objects as JavaScript objects,
// and going back again.
- static Handle<Object> WrapMap(map<string, string>* obj);
+ Handle<Object> WrapMap(map<string, string>* obj);
static map<string, string>* UnwrapMap(Handle<Object> obj);
- static Handle<Object> WrapRequest(HttpRequest* obj);
+ Handle<Object> WrapRequest(HttpRequest* obj);
static HttpRequest* UnwrapRequest(Handle<Object> obj);
+ Isolate* GetIsolate() { return context_->GetIsolate(); }
+
Handle<String> script_;
Persistent<Context> context_;
Persistent<Function> process_;
@@ -187,7 +189,7 @@ bool JsHttpRequestProcessor::Initialize(map<string, string>* opts,
// Store the function in a Persistent handle, since we also want
// that to remain after this call returns
- process_ = Persistent<Function>::New(process_fun);
+ process_ = Persistent<Function>::New(GetIsolate(), process_fun);
// All done; all went well
return true;
@@ -273,8 +275,9 @@ JsHttpRequestProcessor::~JsHttpRequestProcessor() {
// Dispose the persistent handles. When noone else has any
// references to the objects stored in the handles they will be
// automatically reclaimed.
- context_.Dispose();
- process_.Dispose();
+ v8::Isolate* isolate = GetIsolate();
+ context_.Dispose(isolate);
+ process_.Dispose(isolate);
}
@@ -296,7 +299,7 @@ Handle<Object> JsHttpRequestProcessor::WrapMap(map<string, string>* obj) {
// It only has to be created once, which we do on demand.
if (map_template_.IsEmpty()) {
Handle<ObjectTemplate> raw_template = MakeMapTemplate();
- map_template_ = Persistent<ObjectTemplate>::New(raw_template);
+ map_template_ = Persistent<ObjectTemplate>::New(GetIsolate(), raw_template);
}
Handle<ObjectTemplate> templ = map_template_;
@@ -401,7 +404,8 @@ Handle<Object> JsHttpRequestProcessor::WrapRequest(HttpRequest* request) {
// It only has to be created once, which we do on demand.
if (request_template_.IsEmpty()) {
Handle<ObjectTemplate> raw_template = MakeRequestTemplate();
- request_template_ = Persistent<ObjectTemplate>::New(raw_template);
+ request_template_ =
+ Persistent<ObjectTemplate>::New(GetIsolate(), raw_template);
}
Handle<ObjectTemplate> templ = request_template_;
« no previous file with comments | « samples/lineprocessor.cc ('k') | samples/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698