summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2010-12-06 19:01:33 -0800
committerShimeng (Simon) Wang <swang@google.com>2010-12-06 19:01:33 -0800
commit8a31eba00023874d4a1dcdc5f411cc4336776874 (patch)
tree33cb6a918a63be01fdc3e5ed24d015aa5ce6a925 /samples
parent90bac256d9f48d4ee52d0e08bf0e5cad57b3c51c (diff)
downloadandroid_external_v8-8a31eba00023874d4a1dcdc5f411cc4336776874.tar.gz
android_external_v8-8a31eba00023874d4a1dcdc5f411cc4336776874.tar.bz2
android_external_v8-8a31eba00023874d4a1dcdc5f411cc4336776874.zip
Update V8 to r5901 as required by WebKit r73109
Change-Id: Ic48c5b085ce90e0151e2e7e58c4c5afe87fce9d1
Diffstat (limited to 'samples')
-rw-r--r--samples/process.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/samples/process.cc b/samples/process.cc
index 9233c0df..6be4ea54 100644
--- a/samples/process.cc
+++ b/samples/process.cc
@@ -152,18 +152,16 @@ bool JsHttpRequestProcessor::Initialize(map<string, string>* opts,
Handle<ObjectTemplate> global = ObjectTemplate::New();
global->Set(String::New("log"), FunctionTemplate::New(LogCallback));
- // Each processor gets its own context so different processors
- // don't affect each other (ignore the first three lines).
- Handle<Context> context = Context::New(NULL, global);
-
- // Store the context in the processor object in a persistent handle,
- // since we want the reference to remain after we return from this
- // method.
- context_ = Persistent<Context>::New(context);
+ // Each processor gets its own context so different processors don't
+ // affect each other. Context::New returns a persistent handle which
+ // 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_ = Context::New(NULL, global);
// Enter the new context so all the following operations take place
// within it.
- Context::Scope context_scope(context);
+ Context::Scope context_scope(context_);
// Make the options mapping available within the context
if (!InstallMaps(opts, output))
@@ -176,7 +174,7 @@ bool JsHttpRequestProcessor::Initialize(map<string, string>* opts,
// The script compiled and ran correctly. Now we fetch out the
// Process function from the global object.
Handle<String> process_name = String::New("Process");
- Handle<Value> process_val = context->Global()->Get(process_name);
+ Handle<Value> process_val = context_->Global()->Get(process_name);
// If there is no Process function, or if it is not a function,
// bail out