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

Side by Side Diff: samples/process.cc

Issue 1116633002: Pass ArrayBuffer::Allocator via Isolate::CreateParams (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « include/v8.h ('k') | samples/shell.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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 pair<string, string> entry = *i; 655 pair<string, string> entry = *i;
656 printf("%s: %s\n", entry.first.c_str(), entry.second.c_str()); 656 printf("%s: %s\n", entry.first.c_str(), entry.second.c_str());
657 } 657 }
658 } 658 }
659 659
660 660
661 int main(int argc, char* argv[]) { 661 int main(int argc, char* argv[]) {
662 v8::V8::InitializeICU(); 662 v8::V8::InitializeICU();
663 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); 663 v8::Platform* platform = v8::platform::CreateDefaultPlatform();
664 v8::V8::InitializePlatform(platform); 664 v8::V8::InitializePlatform(platform);
665 ArrayBufferAllocator array_buffer_allocator;
666 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
667 v8::V8::Initialize(); 665 v8::V8::Initialize();
668 map<string, string> options; 666 map<string, string> options;
669 string file; 667 string file;
670 ParseOptions(argc, argv, &options, &file); 668 ParseOptions(argc, argv, &options, &file);
671 if (file.empty()) { 669 if (file.empty()) {
672 fprintf(stderr, "No script was specified.\n"); 670 fprintf(stderr, "No script was specified.\n");
673 return 1; 671 return 1;
674 } 672 }
675 Isolate* isolate = Isolate::New(); 673 ArrayBufferAllocator array_buffer_allocator;
674 Isolate::CreateParams create_params;
675 create_params.array_buffer_allocator = &array_buffer_allocator;
676 Isolate* isolate = Isolate::New(create_params);
676 Isolate::Scope isolate_scope(isolate); 677 Isolate::Scope isolate_scope(isolate);
677 HandleScope scope(isolate); 678 HandleScope scope(isolate);
678 Handle<String> source = ReadFile(isolate, file); 679 Handle<String> source = ReadFile(isolate, file);
679 if (source.IsEmpty()) { 680 if (source.IsEmpty()) {
680 fprintf(stderr, "Error reading '%s'.\n", file.c_str()); 681 fprintf(stderr, "Error reading '%s'.\n", file.c_str());
681 return 1; 682 return 1;
682 } 683 }
683 JsHttpRequestProcessor processor(isolate, source); 684 JsHttpRequestProcessor processor(isolate, source);
684 map<string, string> output; 685 map<string, string> output;
685 if (!processor.Initialize(&options, &output)) { 686 if (!processor.Initialize(&options, &output)) {
686 fprintf(stderr, "Error initializing processor.\n"); 687 fprintf(stderr, "Error initializing processor.\n");
687 return 1; 688 return 1;
688 } 689 }
689 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) 690 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests))
690 return 1; 691 return 1;
691 PrintMap(&output); 692 PrintMap(&output);
692 } 693 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | samples/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698