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

Side by Side Diff: samples/shell.cc

Issue 108063003: Removed internal uses of (almost) deprecated FunctionTemplate::New version. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 96
97 // Creates a new execution environment containing the built-in 97 // Creates a new execution environment containing the built-in
98 // functions. 98 // functions.
99 v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate) { 99 v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate) {
100 // Create a template for the global object. 100 // Create a template for the global object.
101 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); 101 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
102 // Bind the global 'print' function to the C++ Print callback. 102 // Bind the global 'print' function to the C++ Print callback.
103 global->Set(v8::String::NewFromUtf8(isolate, "print"), 103 global->Set(v8::String::NewFromUtf8(isolate, "print"),
104 v8::FunctionTemplate::New(Print)); 104 v8::FunctionTemplate::New(isolate, Print));
105 // Bind the global 'read' function to the C++ Read callback. 105 // Bind the global 'read' function to the C++ Read callback.
106 global->Set(v8::String::NewFromUtf8(isolate, "read"), 106 global->Set(v8::String::NewFromUtf8(isolate, "read"),
107 v8::FunctionTemplate::New(Read)); 107 v8::FunctionTemplate::New(isolate, Read));
108 // Bind the global 'load' function to the C++ Load callback. 108 // Bind the global 'load' function to the C++ Load callback.
109 global->Set(v8::String::NewFromUtf8(isolate, "load"), 109 global->Set(v8::String::NewFromUtf8(isolate, "load"),
110 v8::FunctionTemplate::New(Load)); 110 v8::FunctionTemplate::New(isolate, Load));
111 // Bind the 'quit' function 111 // Bind the 'quit' function
112 global->Set(v8::String::NewFromUtf8(isolate, "quit"), 112 global->Set(v8::String::NewFromUtf8(isolate, "quit"),
113 v8::FunctionTemplate::New(Quit)); 113 v8::FunctionTemplate::New(isolate, Quit));
114 // Bind the 'version' function 114 // Bind the 'version' function
115 global->Set(v8::String::NewFromUtf8(isolate, "version"), 115 global->Set(v8::String::NewFromUtf8(isolate, "version"),
116 v8::FunctionTemplate::New(Version)); 116 v8::FunctionTemplate::New(isolate, Version));
117 117
118 return v8::Context::New(isolate, NULL, global); 118 return v8::Context::New(isolate, NULL, global);
119 } 119 }
120 120
121 121
122 // The callback that is invoked by v8 whenever the JavaScript 'print' 122 // The callback that is invoked by v8 whenever the JavaScript 'print'
123 // function is called. Prints its arguments on stdout separated by 123 // function is called. Prints its arguments on stdout separated by
124 // spaces and ending with a newline. 124 // spaces and ending with a newline.
125 void Print(const v8::FunctionCallbackInfo<v8::Value>& args) { 125 void Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
126 bool first = true; 126 bool first = true;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 fprintf(stderr, "^"); 362 fprintf(stderr, "^");
363 } 363 }
364 fprintf(stderr, "\n"); 364 fprintf(stderr, "\n");
365 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 365 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
366 if (stack_trace.length() > 0) { 366 if (stack_trace.length() > 0) {
367 const char* stack_trace_string = ToCString(stack_trace); 367 const char* stack_trace_string = ToCString(stack_trace);
368 fprintf(stderr, "%s\n", stack_trace_string); 368 fprintf(stderr, "%s\n", stack_trace_string);
369 } 369 }
370 } 370 }
371 } 371 }
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