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

Side by Side Diff: samples/lineprocessor.cc

Issue 124943004: Prepare removal of ObjectTemplate::New without Isolate parameter. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Do not remove ObjectTemplate::New() yet. Created 6 years, 11 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 | « no previous file | samples/process.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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (script_param_counter == 0) { 193 if (script_param_counter == 0) {
194 printf("Script is not specified\n"); 194 printf("Script is not specified\n");
195 return 1; 195 return 1;
196 } 196 }
197 if (script_param_counter != 1) { 197 if (script_param_counter != 1) {
198 printf("Only one script may be specified\n"); 198 printf("Only one script may be specified\n");
199 return 1; 199 return 1;
200 } 200 }
201 201
202 // Create a template for the global object. 202 // Create a template for the global object.
203 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); 203 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
204 204
205 // Bind the global 'print' function to the C++ Print callback. 205 // Bind the global 'print' function to the C++ Print callback.
206 global->Set(v8::String::NewFromUtf8(isolate, "print"), 206 global->Set(v8::String::NewFromUtf8(isolate, "print"),
207 v8::FunctionTemplate::New(isolate, Print)); 207 v8::FunctionTemplate::New(isolate, Print));
208 208
209 if (cycle_type == CycleInJs) { 209 if (cycle_type == CycleInJs) {
210 // Bind the global 'read_line' function to the C++ Print callback. 210 // Bind the global 'read_line' function to the C++ Print callback.
211 global->Set(v8::String::NewFromUtf8(isolate, "read_line"), 211 global->Set(v8::String::NewFromUtf8(isolate, "read_line"),
212 v8::FunctionTemplate::New(isolate, ReadLine)); 212 v8::FunctionTemplate::New(isolate, ReadLine));
213 } 213 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 446 }
447 // Remove newline char 447 // Remove newline char
448 for (char* pos = buffer; *pos != '\0'; pos++) { 448 for (char* pos = buffer; *pos != '\0'; pos++) {
449 if (*pos == '\n') { 449 if (*pos == '\n') {
450 *pos = '\0'; 450 *pos = '\0';
451 break; 451 break;
452 } 452 }
453 } 453 }
454 return v8::String::NewFromUtf8(isolate, buffer); 454 return v8::String::NewFromUtf8(isolate, buffer);
455 } 455 }
OLDNEW
« no previous file with comments | « no previous file | samples/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698