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

Side by Side Diff: test/inspector/inspector-test.cc

Issue 2836623002: [inspector] always include user scripts in the snapshot. (Closed)
Patch Set: rebase Created 3 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 | « test/inspector/debugger/step-snapshot-expected.txt ('k') | test/inspector/task-runner.h » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if !defined(_WIN32) && !defined(_WIN64) 5 #if !defined(_WIN32) && !defined(_WIN64)
6 #include <unistd.h> // NOLINT 6 #include <unistd.h> // NOLINT
7 #endif // !defined(_WIN32) && !defined(_WIN64) 7 #endif // !defined(_WIN32) && !defined(_WIN64)
8 8
9 #include <locale.h> 9 #include <locale.h>
10 10
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 int main(int argc, char* argv[]) { 582 int main(int argc, char* argv[]) {
583 v8::V8::InitializeICUDefaultLocation(argv[0]); 583 v8::V8::InitializeICUDefaultLocation(argv[0]);
584 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); 584 v8::Platform* platform = v8::platform::CreateDefaultPlatform();
585 v8::V8::InitializePlatform(platform); 585 v8::V8::InitializePlatform(platform);
586 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 586 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
587 v8::V8::InitializeExternalStartupData(argv[0]); 587 v8::V8::InitializeExternalStartupData(argv[0]);
588 v8::V8::Initialize(); 588 v8::V8::Initialize();
589 589
590 v8::base::Semaphore ready_semaphore(0); 590 v8::base::Semaphore ready_semaphore(0);
591 591
592 v8::StartupData startup_data = {nullptr, 0};
593 for (int i = 1; i < argc; ++i) {
594 if (strcmp(argv[i], "--embed") == 0) {
595 argv[i++] = nullptr;
596 printf("Embedding script '%s'\n", argv[i]);
597 startup_data = v8::V8::CreateSnapshotDataBlob(argv[i]);
598 argv[i] = nullptr;
599 }
600 }
601
592 TaskRunner::SetupGlobalTasks backend_extensions; 602 TaskRunner::SetupGlobalTasks backend_extensions;
593 backend_extensions.emplace_back(new SetTimeoutExtension()); 603 backend_extensions.emplace_back(new SetTimeoutExtension());
594 backend_extensions.emplace_back(new InspectorExtension()); 604 backend_extensions.emplace_back(new InspectorExtension());
595 TaskRunner backend_runner(std::move(backend_extensions), false, 605 TaskRunner backend_runner(std::move(backend_extensions), false,
596 &ready_semaphore); 606 &ready_semaphore,
607 startup_data.data ? &startup_data : nullptr);
597 ready_semaphore.Wait(); 608 ready_semaphore.Wait();
598 SendMessageToBackendExtension::set_backend_task_runner(&backend_runner); 609 SendMessageToBackendExtension::set_backend_task_runner(&backend_runner);
599 UtilsExtension::set_backend_task_runner(&backend_runner); 610 UtilsExtension::set_backend_task_runner(&backend_runner);
600 611
601 TaskRunner::SetupGlobalTasks frontend_extensions; 612 TaskRunner::SetupGlobalTasks frontend_extensions;
602 frontend_extensions.emplace_back(new UtilsExtension()); 613 frontend_extensions.emplace_back(new UtilsExtension());
603 frontend_extensions.emplace_back(new SendMessageToBackendExtension()); 614 frontend_extensions.emplace_back(new SendMessageToBackendExtension());
604 TaskRunner frontend_runner(std::move(frontend_extensions), true, 615 TaskRunner frontend_runner(std::move(frontend_extensions), true,
605 &ready_semaphore); 616 &ready_semaphore, nullptr);
606 ready_semaphore.Wait(); 617 ready_semaphore.Wait();
607 618
608 FrontendChannelImpl frontend_channel(&frontend_runner); 619 FrontendChannelImpl frontend_channel(&frontend_runner);
609 InspectorClientImpl inspector_client(&backend_runner, &frontend_channel, 620 InspectorClientImpl inspector_client(&backend_runner, &frontend_channel,
610 &ready_semaphore); 621 &ready_semaphore);
611 ready_semaphore.Wait(); 622 ready_semaphore.Wait();
612 UtilsExtension::set_inspector_client(&inspector_client); 623 UtilsExtension::set_inspector_client(&inspector_client);
613 624
614 task_runners.push_back(&frontend_runner); 625 task_runners.push_back(&frontend_runner);
615 task_runners.push_back(&backend_runner); 626 task_runners.push_back(&backend_runner);
616 627
617 for (int i = 1; i < argc; ++i) { 628 for (int i = 1; i < argc; ++i) {
618 // Ignore unknown flags. 629 // Ignore unknown flags.
619 if (argv[i][0] == '-') continue; 630 if (argv[i] == nullptr || argv[i][0] == '-') continue;
620 631
621 bool exists = false; 632 bool exists = false;
622 v8::internal::Vector<const char> chars = 633 v8::internal::Vector<const char> chars =
623 v8::internal::ReadFile(argv[i], &exists, true); 634 v8::internal::ReadFile(argv[i], &exists, true);
624 if (!exists) { 635 if (!exists) {
625 fprintf(stderr, "Internal error: script file doesn't exists: %s\n", 636 fprintf(stderr, "Internal error: script file doesn't exists: %s\n",
626 argv[i]); 637 argv[i]);
627 Exit(); 638 Exit();
628 } 639 }
629 frontend_runner.Append(new ExecuteStringTask(chars)); 640 frontend_runner.Append(new ExecuteStringTask(chars));
630 } 641 }
631 642
632 frontend_runner.Join(); 643 frontend_runner.Join();
633 backend_runner.Join(); 644 backend_runner.Join();
645
646 delete startup_data.data;
634 return 0; 647 return 0;
635 } 648 }
OLDNEW
« no previous file with comments | « test/inspector/debugger/step-snapshot-expected.txt ('k') | test/inspector/task-runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698