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

Side by Side Diff: samples/lineprocessor.cc

Issue 18860007: Move InitializeICU() to the V8 API and use it. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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') | 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 v8::Local<v8::Context>::New(isolate, debug_message_context); 130 v8::Local<v8::Context>::New(isolate, debug_message_context);
131 v8::Context::Scope scope(context); 131 v8::Context::Scope scope(context);
132 132
133 v8::Debug::ProcessDebugMessages(); 133 v8::Debug::ProcessDebugMessages();
134 } 134 }
135 #endif // ENABLE_DEBUGGER_SUPPORT 135 #endif // ENABLE_DEBUGGER_SUPPORT
136 136
137 137
138 int RunMain(int argc, char* argv[]) { 138 int RunMain(int argc, char* argv[]) {
139 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 139 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
140 v8::V8::SetFlagsFromString("--noenable_i18n",
141 static_cast<int>(strlen("--noenable_i18n")));
142 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 140 v8::Isolate* isolate = v8::Isolate::GetCurrent();
143 v8::HandleScope handle_scope(isolate); 141 v8::HandleScope handle_scope(isolate);
144 142
145 v8::Handle<v8::String> script_source; 143 v8::Handle<v8::String> script_source;
146 v8::Handle<v8::Value> script_name; 144 v8::Handle<v8::Value> script_name;
147 int script_param_counter = 0; 145 int script_param_counter = 0;
148 146
149 #ifdef ENABLE_DEBUGGER_SUPPORT 147 #ifdef ENABLE_DEBUGGER_SUPPORT
150 int port_number = -1; 148 int port_number = -1;
151 bool wait_for_connection = false; 149 bool wait_for_connection = false;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 v8::String::Utf8Value str(result); 317 v8::String::Utf8Value str(result);
320 const char* cstr = ToCString(str); 318 const char* cstr = ToCString(str);
321 printf("%s\n", cstr); 319 printf("%s\n", cstr);
322 } 320 }
323 321
324 return true; 322 return true;
325 } 323 }
326 324
327 325
328 int main(int argc, char* argv[]) { 326 int main(int argc, char* argv[]) {
327 v8::V8::InitializeICU();
329 int result = RunMain(argc, argv); 328 int result = RunMain(argc, argv);
330 v8::V8::Dispose(); 329 v8::V8::Dispose();
331 return result; 330 return result;
332 } 331 }
333 332
334 333
335 // Extracts a C string from a V8 Utf8Value. 334 // Extracts a C string from a V8 Utf8Value.
336 const char* ToCString(const v8::String::Utf8Value& value) { 335 const char* ToCString(const v8::String::Utf8Value& value) {
337 return *value ? *value : "<string conversion failed>"; 336 return *value ? *value : "<string conversion failed>";
338 } 337 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 441 }
443 // Remove newline char 442 // Remove newline char
444 for (char* pos = buffer; *pos != '\0'; pos++) { 443 for (char* pos = buffer; *pos != '\0'; pos++) {
445 if (*pos == '\n') { 444 if (*pos == '\n') {
446 *pos = '\0'; 445 *pos = '\0';
447 break; 446 break;
448 } 447 }
449 } 448 }
450 return v8::String::New(buffer); 449 return v8::String::New(buffer);
451 } 450 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | samples/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698