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

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

Issue 2840923002: Revert of [inspector] always include user scripts in the snapshot. (Closed)
Patch Set: Created 3 years, 8 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
602 TaskRunner::SetupGlobalTasks backend_extensions; 592 TaskRunner::SetupGlobalTasks backend_extensions;
603 backend_extensions.emplace_back(new SetTimeoutExtension()); 593 backend_extensions.emplace_back(new SetTimeoutExtension());
604 backend_extensions.emplace_back(new InspectorExtension()); 594 backend_extensions.emplace_back(new InspectorExtension());
605 TaskRunner backend_runner(std::move(backend_extensions), false, 595 TaskRunner backend_runner(std::move(backend_extensions), false,
606 &ready_semaphore, 596 &ready_semaphore);
607 startup_data.data ? &startup_data : nullptr);
608 ready_semaphore.Wait(); 597 ready_semaphore.Wait();
609 SendMessageToBackendExtension::set_backend_task_runner(&backend_runner); 598 SendMessageToBackendExtension::set_backend_task_runner(&backend_runner);
610 UtilsExtension::set_backend_task_runner(&backend_runner); 599 UtilsExtension::set_backend_task_runner(&backend_runner);
611 600
612 TaskRunner::SetupGlobalTasks frontend_extensions; 601 TaskRunner::SetupGlobalTasks frontend_extensions;
613 frontend_extensions.emplace_back(new UtilsExtension()); 602 frontend_extensions.emplace_back(new UtilsExtension());
614 frontend_extensions.emplace_back(new SendMessageToBackendExtension()); 603 frontend_extensions.emplace_back(new SendMessageToBackendExtension());
615 TaskRunner frontend_runner(std::move(frontend_extensions), true, 604 TaskRunner frontend_runner(std::move(frontend_extensions), true,
616 &ready_semaphore, nullptr); 605 &ready_semaphore);
617 ready_semaphore.Wait(); 606 ready_semaphore.Wait();
618 607
619 FrontendChannelImpl frontend_channel(&frontend_runner); 608 FrontendChannelImpl frontend_channel(&frontend_runner);
620 InspectorClientImpl inspector_client(&backend_runner, &frontend_channel, 609 InspectorClientImpl inspector_client(&backend_runner, &frontend_channel,
621 &ready_semaphore); 610 &ready_semaphore);
622 ready_semaphore.Wait(); 611 ready_semaphore.Wait();
623 UtilsExtension::set_inspector_client(&inspector_client); 612 UtilsExtension::set_inspector_client(&inspector_client);
624 613
625 task_runners.push_back(&frontend_runner); 614 task_runners.push_back(&frontend_runner);
626 task_runners.push_back(&backend_runner); 615 task_runners.push_back(&backend_runner);
627 616
628 for (int i = 1; i < argc; ++i) { 617 for (int i = 1; i < argc; ++i) {
629 // Ignore unknown flags. 618 // Ignore unknown flags.
630 if (argv[i] == nullptr || argv[i][0] == '-') continue; 619 if (argv[i][0] == '-') continue;
631 620
632 bool exists = false; 621 bool exists = false;
633 v8::internal::Vector<const char> chars = 622 v8::internal::Vector<const char> chars =
634 v8::internal::ReadFile(argv[i], &exists, true); 623 v8::internal::ReadFile(argv[i], &exists, true);
635 if (!exists) { 624 if (!exists) {
636 fprintf(stderr, "Internal error: script file doesn't exists: %s\n", 625 fprintf(stderr, "Internal error: script file doesn't exists: %s\n",
637 argv[i]); 626 argv[i]);
638 Exit(); 627 Exit();
639 } 628 }
640 frontend_runner.Append(new ExecuteStringTask(chars)); 629 frontend_runner.Append(new ExecuteStringTask(chars));
641 } 630 }
642 631
643 frontend_runner.Join(); 632 frontend_runner.Join();
644 backend_runner.Join(); 633 backend_runner.Join();
645
646 delete startup_data.data;
647 return 0; 634 return 0;
648 } 635 }
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