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

Side by Side Diff: samples/process.cc

Issue 1154423004: Update all callsites of the TryCatch ctor to pass an Isolate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | samples/shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // All done; all went well 213 // All done; all went well
214 return true; 214 return true;
215 } 215 }
216 216
217 217
218 bool JsHttpRequestProcessor::ExecuteScript(Handle<String> script) { 218 bool JsHttpRequestProcessor::ExecuteScript(Handle<String> script) {
219 HandleScope handle_scope(GetIsolate()); 219 HandleScope handle_scope(GetIsolate());
220 220
221 // We're just about to compile the script; set up an error handler to 221 // We're just about to compile the script; set up an error handler to
222 // catch any exceptions the script might throw. 222 // catch any exceptions the script might throw.
223 TryCatch try_catch; 223 TryCatch try_catch(GetIsolate());
224 224
225 // Compile the script and check for errors. 225 // Compile the script and check for errors.
226 Handle<Script> compiled_script = Script::Compile(script); 226 Handle<Script> compiled_script = Script::Compile(script);
227 if (compiled_script.IsEmpty()) { 227 if (compiled_script.IsEmpty()) {
228 String::Utf8Value error(try_catch.Exception()); 228 String::Utf8Value error(try_catch.Exception());
229 Log(*error); 229 Log(*error);
230 // The script failed to compile; bail out. 230 // The script failed to compile; bail out.
231 return false; 231 return false;
232 } 232 }
233 233
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 v8::Local<v8::Context>::New(GetIsolate(), context_); 274 v8::Local<v8::Context>::New(GetIsolate(), context_);
275 275
276 // Enter this processor's context so all the remaining operations 276 // Enter this processor's context so all the remaining operations
277 // take place there 277 // take place there
278 Context::Scope context_scope(context); 278 Context::Scope context_scope(context);
279 279
280 // Wrap the C++ request object in a JavaScript wrapper 280 // Wrap the C++ request object in a JavaScript wrapper
281 Handle<Object> request_obj = WrapRequest(request); 281 Handle<Object> request_obj = WrapRequest(request);
282 282
283 // Set up an exception handler before calling the Process function 283 // Set up an exception handler before calling the Process function
284 TryCatch try_catch; 284 TryCatch try_catch(GetIsolate());
285 285
286 // Invoke the process function, giving the global object as 'this' 286 // Invoke the process function, giving the global object as 'this'
287 // and one argument, the request. 287 // and one argument, the request.
288 const int argc = 1; 288 const int argc = 1;
289 Handle<Value> argv[argc] = { request_obj }; 289 Handle<Value> argv[argc] = { request_obj };
290 v8::Local<v8::Function> process = 290 v8::Local<v8::Function> process =
291 v8::Local<v8::Function>::New(GetIsolate(), process_); 291 v8::Local<v8::Function>::New(GetIsolate(), process_);
292 Handle<Value> result = process->Call(context->Global(), argc, argv); 292 Handle<Value> result = process->Call(context->Global(), argc, argv);
293 if (result.IsEmpty()) { 293 if (result.IsEmpty()) {
294 String::Utf8Value error(try_catch.Exception()); 294 String::Utf8Value error(try_catch.Exception());
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 JsHttpRequestProcessor processor(isolate, source); 684 JsHttpRequestProcessor processor(isolate, source);
685 map<string, string> output; 685 map<string, string> output;
686 if (!processor.Initialize(&options, &output)) { 686 if (!processor.Initialize(&options, &output)) {
687 fprintf(stderr, "Error initializing processor.\n"); 687 fprintf(stderr, "Error initializing processor.\n");
688 return 1; 688 return 1;
689 } 689 }
690 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) 690 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests))
691 return 1; 691 return 1;
692 PrintMap(&output); 692 PrintMap(&output);
693 } 693 }
OLDNEW
« no previous file with comments | « no previous file | samples/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698