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

Side by Side Diff: samples/lineprocessor.cc

Issue 24508006: remove uses of static oddball accessors using GetCurrent in advance of removal from api (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits Created 7 years, 2 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 | « include/v8.h ('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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 // It is a function; cast it to a Function 290 // It is a function; cast it to a Function
291 v8::Handle<v8::Function> process_fun = 291 v8::Handle<v8::Function> process_fun =
292 v8::Handle<v8::Function>::Cast(process_val); 292 v8::Handle<v8::Function>::Cast(process_val);
293 293
294 294
295 while (!feof(stdin)) { 295 while (!feof(stdin)) {
296 v8::HandleScope handle_scope(isolate); 296 v8::HandleScope handle_scope(isolate);
297 297
298 v8::Handle<v8::String> input_line = ReadLine(); 298 v8::Handle<v8::String> input_line = ReadLine();
299 if (input_line == v8::Undefined()) { 299 if (input_line == v8::Undefined(isolate)) {
300 continue; 300 continue;
301 } 301 }
302 302
303 const int argc = 1; 303 const int argc = 1;
304 v8::Handle<v8::Value> argv[argc] = { input_line }; 304 v8::Handle<v8::Value> argv[argc] = { input_line };
305 305
306 v8::Handle<v8::Value> result; 306 v8::Handle<v8::Value> result;
307 { 307 {
308 v8::TryCatch try_catch; 308 v8::TryCatch try_catch;
309 result = process_fun->Call(isolate->GetCurrentContext()->Global(), 309 result = process_fun->Call(isolate->GetCurrentContext()->Global(),
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 char buffer[kBufferSize]; 429 char buffer[kBufferSize];
430 430
431 char* res; 431 char* res;
432 { 432 {
433 #ifdef ENABLE_DEBUGGER_SUPPORT 433 #ifdef ENABLE_DEBUGGER_SUPPORT
434 v8::Unlocker unlocker(v8::Isolate::GetCurrent()); 434 v8::Unlocker unlocker(v8::Isolate::GetCurrent());
435 #endif // ENABLE_DEBUGGER_SUPPORT 435 #endif // ENABLE_DEBUGGER_SUPPORT
436 res = fgets(buffer, kBufferSize, stdin); 436 res = fgets(buffer, kBufferSize, stdin);
437 } 437 }
438 if (res == NULL) { 438 if (res == NULL) {
439 v8::Handle<v8::Primitive> t = v8::Undefined(); 439 v8::Handle<v8::Primitive> t = v8::Undefined(v8::Isolate::GetCurrent());
440 return v8::Handle<v8::String>::Cast(t); 440 return v8::Handle<v8::String>::Cast(t);
441 } 441 }
442 // Remove newline char 442 // Remove newline char
443 for (char* pos = buffer; *pos != '\0'; pos++) { 443 for (char* pos = buffer; *pos != '\0'; pos++) {
444 if (*pos == '\n') { 444 if (*pos == '\n') {
445 *pos = '\0'; 445 *pos = '\0';
446 break; 446 break;
447 } 447 }
448 } 448 }
449 return v8::String::New(buffer); 449 return v8::String::New(buffer);
450 } 450 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698