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

Side by Side Diff: samples/process.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 | « samples/lineprocessor.cc ('k') | samples/samples.gyp » ('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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include <v8.h> 28 #include <v8.h>
29 29
30 #include <cstring>
31 #include <string> 30 #include <string>
32 #include <map> 31 #include <map>
33 32
34 #ifdef COMPRESS_STARTUP_DATA_BZ2 33 #ifdef COMPRESS_STARTUP_DATA_BZ2
35 #error Using compressed startup data is not supported for this sample 34 #error Using compressed startup data is not supported for this sample
36 #endif 35 #endif
37 36
38 using namespace std; 37 using namespace std;
39 using namespace v8; 38 using namespace v8;
40 39
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 620
622 void PrintMap(map<string, string>* m) { 621 void PrintMap(map<string, string>* m) {
623 for (map<string, string>::iterator i = m->begin(); i != m->end(); i++) { 622 for (map<string, string>::iterator i = m->begin(); i != m->end(); i++) {
624 pair<string, string> entry = *i; 623 pair<string, string> entry = *i;
625 printf("%s: %s\n", entry.first.c_str(), entry.second.c_str()); 624 printf("%s: %s\n", entry.first.c_str(), entry.second.c_str());
626 } 625 }
627 } 626 }
628 627
629 628
630 int main(int argc, char* argv[]) { 629 int main(int argc, char* argv[]) {
630 v8::V8::InitializeICU();
631 map<string, string> options; 631 map<string, string> options;
632 string file; 632 string file;
633 ParseOptions(argc, argv, options, &file); 633 ParseOptions(argc, argv, options, &file);
634 if (file.empty()) { 634 if (file.empty()) {
635 fprintf(stderr, "No script was specified.\n"); 635 fprintf(stderr, "No script was specified.\n");
636 return 1; 636 return 1;
637 } 637 }
638 V8::SetFlagsFromString("--noenable_i18n",
639 static_cast<int>(strlen("--noenable_i18n")));
640 Isolate* isolate = Isolate::GetCurrent(); 638 Isolate* isolate = Isolate::GetCurrent();
641 HandleScope scope(isolate); 639 HandleScope scope(isolate);
642 Handle<String> source = ReadFile(file); 640 Handle<String> source = ReadFile(file);
643 if (source.IsEmpty()) { 641 if (source.IsEmpty()) {
644 fprintf(stderr, "Error reading '%s'.\n", file.c_str()); 642 fprintf(stderr, "Error reading '%s'.\n", file.c_str());
645 return 1; 643 return 1;
646 } 644 }
647 JsHttpRequestProcessor processor(isolate, source); 645 JsHttpRequestProcessor processor(isolate, source);
648 map<string, string> output; 646 map<string, string> output;
649 if (!processor.Initialize(&options, &output)) { 647 if (!processor.Initialize(&options, &output)) {
650 fprintf(stderr, "Error initializing processor.\n"); 648 fprintf(stderr, "Error initializing processor.\n");
651 return 1; 649 return 1;
652 } 650 }
653 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) 651 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests))
654 return 1; 652 return 1;
655 PrintMap(&output); 653 PrintMap(&output);
656 } 654 }
OLDNEW
« no previous file with comments | « samples/lineprocessor.cc ('k') | samples/samples.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698