| OLD | NEW | 
|---|
| 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 639 void PrintMap(map<string, string>* m) { | 639 void PrintMap(map<string, string>* m) { | 
| 640   for (map<string, string>::iterator i = m->begin(); i != m->end(); i++) { | 640   for (map<string, string>::iterator i = m->begin(); i != m->end(); i++) { | 
| 641     pair<string, string> entry = *i; | 641     pair<string, string> entry = *i; | 
| 642     printf("%s: %s\n", entry.first.c_str(), entry.second.c_str()); | 642     printf("%s: %s\n", entry.first.c_str(), entry.second.c_str()); | 
| 643   } | 643   } | 
| 644 } | 644 } | 
| 645 | 645 | 
| 646 | 646 | 
| 647 int main(int argc, char* argv[]) { | 647 int main(int argc, char* argv[]) { | 
| 648   v8::V8::InitializeICU(); | 648   v8::V8::InitializeICU(); | 
| 649   v8::Platform* platform = v8::platform::CreateDefaultPlatform(0); | 649   v8::Platform* platform = v8::platform::CreateDefaultPlatform(); | 
| 650   v8::V8::InitializePlatform(platform); | 650   v8::V8::InitializePlatform(platform); | 
| 651   map<string, string> options; | 651   map<string, string> options; | 
| 652   string file; | 652   string file; | 
| 653   ParseOptions(argc, argv, &options, &file); | 653   ParseOptions(argc, argv, &options, &file); | 
| 654   if (file.empty()) { | 654   if (file.empty()) { | 
| 655     fprintf(stderr, "No script was specified.\n"); | 655     fprintf(stderr, "No script was specified.\n"); | 
| 656     return 1; | 656     return 1; | 
| 657   } | 657   } | 
| 658   Isolate* isolate = Isolate::New(); | 658   Isolate* isolate = Isolate::New(); | 
| 659   Isolate::Scope isolate_scope(isolate); | 659   Isolate::Scope isolate_scope(isolate); | 
| 660   HandleScope scope(isolate); | 660   HandleScope scope(isolate); | 
| 661   Handle<String> source = ReadFile(isolate, file); | 661   Handle<String> source = ReadFile(isolate, file); | 
| 662   if (source.IsEmpty()) { | 662   if (source.IsEmpty()) { | 
| 663     fprintf(stderr, "Error reading '%s'.\n", file.c_str()); | 663     fprintf(stderr, "Error reading '%s'.\n", file.c_str()); | 
| 664     return 1; | 664     return 1; | 
| 665   } | 665   } | 
| 666   JsHttpRequestProcessor processor(isolate, source); | 666   JsHttpRequestProcessor processor(isolate, source); | 
| 667   map<string, string> output; | 667   map<string, string> output; | 
| 668   if (!processor.Initialize(&options, &output)) { | 668   if (!processor.Initialize(&options, &output)) { | 
| 669     fprintf(stderr, "Error initializing processor.\n"); | 669     fprintf(stderr, "Error initializing processor.\n"); | 
| 670     return 1; | 670     return 1; | 
| 671   } | 671   } | 
| 672   if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) | 672   if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) | 
| 673     return 1; | 673     return 1; | 
| 674   PrintMap(&output); | 674   PrintMap(&output); | 
| 675 } | 675 } | 
| OLD | NEW | 
|---|