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

Side by Side Diff: samples/shell.cc

Issue 892083002: shell.cc race condition (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « AUTHORS ('k') | no next file » | 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 v8::HandleScope handle_scope(isolate); 91 v8::HandleScope handle_scope(isolate);
92 v8::Handle<v8::Context> context = CreateShellContext(isolate); 92 v8::Handle<v8::Context> context = CreateShellContext(isolate);
93 if (context.IsEmpty()) { 93 if (context.IsEmpty()) {
94 fprintf(stderr, "Error creating context\n"); 94 fprintf(stderr, "Error creating context\n");
95 return 1; 95 return 1;
96 } 96 }
97 v8::Context::Scope context_scope(context); 97 v8::Context::Scope context_scope(context);
98 result = RunMain(isolate, argc, argv); 98 result = RunMain(isolate, argc, argv);
99 if (run_shell) RunShell(context); 99 if (run_shell) RunShell(context);
100 } 100 }
101 isolate->Dispose();
101 v8::V8::Dispose(); 102 v8::V8::Dispose();
102 v8::V8::ShutdownPlatform(); 103 v8::V8::ShutdownPlatform();
103 delete platform; 104 delete platform;
104 return result; 105 return result;
105 } 106 }
106 107
107 108
108 // Extracts a C string from a V8 Utf8Value. 109 // Extracts a C string from a V8 Utf8Value.
109 const char* ToCString(const v8::String::Utf8Value& value) { 110 const char* ToCString(const v8::String::Utf8Value& value) {
110 return *value ? *value : "<string conversion failed>"; 111 return *value ? *value : "<string conversion failed>";
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 fprintf(stderr, "^"); 381 fprintf(stderr, "^");
381 } 382 }
382 fprintf(stderr, "\n"); 383 fprintf(stderr, "\n");
383 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 384 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
384 if (stack_trace.length() > 0) { 385 if (stack_trace.length() > 0) {
385 const char* stack_trace_string = ToCString(stack_trace); 386 const char* stack_trace_string = ToCString(stack_trace);
386 fprintf(stderr, "%s\n", stack_trace_string); 387 fprintf(stderr, "%s\n", stack_trace_string);
387 } 388 }
388 } 389 }
389 } 390 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698