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

Side by Side Diff: samples/shell.cc

Issue 238353015: Simplify v8/Isolate teardown. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Tiny serializer fix after recent changes. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « samples/process.cc ('k') | src/api.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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void Version(const v8::FunctionCallbackInfo<v8::Value>& args); 60 void Version(const v8::FunctionCallbackInfo<v8::Value>& args);
61 v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name); 61 v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name);
62 void ReportException(v8::Isolate* isolate, v8::TryCatch* handler); 62 void ReportException(v8::Isolate* isolate, v8::TryCatch* handler);
63 63
64 64
65 static bool run_shell; 65 static bool run_shell;
66 66
67 67
68 int main(int argc, char* argv[]) { 68 int main(int argc, char* argv[]) {
69 v8::V8::InitializeICU(); 69 v8::V8::InitializeICU();
70 v8::V8::Initialize();
70 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 71 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
71 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 72 v8::Isolate* isolate = v8::Isolate::GetCurrent();
72 run_shell = (argc == 1); 73 run_shell = (argc == 1);
73 int result; 74 int result;
74 { 75 {
75 v8::HandleScope handle_scope(isolate); 76 v8::HandleScope handle_scope(isolate);
76 v8::Handle<v8::Context> context = CreateShellContext(isolate); 77 v8::Handle<v8::Context> context = CreateShellContext(isolate);
77 if (context.IsEmpty()) { 78 if (context.IsEmpty()) {
78 fprintf(stderr, "Error creating context\n"); 79 fprintf(stderr, "Error creating context\n");
79 return 1; 80 return 1;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 fprintf(stderr, "^"); 364 fprintf(stderr, "^");
364 } 365 }
365 fprintf(stderr, "\n"); 366 fprintf(stderr, "\n");
366 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 367 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
367 if (stack_trace.length() > 0) { 368 if (stack_trace.length() > 0) {
368 const char* stack_trace_string = ToCString(stack_trace); 369 const char* stack_trace_string = ToCString(stack_trace);
369 fprintf(stderr, "%s\n", stack_trace_string); 370 fprintf(stderr, "%s\n", stack_trace_string);
370 } 371 }
371 } 372 }
372 } 373 }
OLDNEW
« no previous file with comments | « samples/process.cc ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698