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

Side by Side Diff: content/app/content_main_runner.cc

Issue 1164483003: Allow startup with missing V8 snapshot file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "content/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); 721 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor);
722 } 722 }
723 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { 723 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) {
724 g_fds->Set( 724 g_fds->Set(
725 kV8SnapshotDataDescriptor, 725 kV8SnapshotDataDescriptor,
726 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); 726 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor);
727 } 727 }
728 #endif // !OS_ANDROID 728 #endif // !OS_ANDROID
729 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); 729 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor);
730 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); 730 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor);
731 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) { 731 if (v8_snapshot_fd != -1) {
732 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor);
733 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); 732 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor);
734 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD( 733 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD(
735 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size,
736 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size)); 734 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size));
737 } else { 735 } else {
738 CHECK(gin::V8Initializer::LoadV8Snapshot()); 736 gin::V8Initializer::LoadV8Snapshot();
737 }
738 if (v8_natives_fd != -1) {
739 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor);
740 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD(
741 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size));
742 } else {
743 CHECK(gin::V8Initializer::LoadV8Natives());
739 } 744 }
740 #else 745 #else
741 CHECK(gin::V8Initializer::LoadV8Snapshot()); 746 gin::V8Initializer::LoadV8Snapshot();
rmcilroy 2015/06/01 14:06:31 Maybe we should make it obvious from the function
Erik Corry Chromium.org 2015/06/02 11:18:52 Not sure I want to CHECK it. Lets say it's there,
rmcilroy 2015/06/02 11:27:07 As discussed below, let's get rid of the return va
747 CHECK(gin::V8Initializer::LoadV8Natives());
742 #endif // OS_POSIX && !OS_MACOSX 748 #endif // OS_POSIX && !OS_MACOSX
743 #endif // V8_USE_EXTERNAL_STARTUP_DATA 749 #endif // V8_USE_EXTERNAL_STARTUP_DATA
744 750
745 if (delegate_) 751 if (delegate_)
746 delegate_->PreSandboxStartup(); 752 delegate_->PreSandboxStartup();
747 753
748 if (!process_type.empty()) 754 if (!process_type.empty())
749 CommonSubprocessInit(process_type); 755 CommonSubprocessInit(process_type);
750 756
751 #if defined(OS_WIN) 757 #if defined(OS_WIN)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 853
848 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 854 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
849 }; 855 };
850 856
851 // static 857 // static
852 ContentMainRunner* ContentMainRunner::Create() { 858 ContentMainRunner* ContentMainRunner::Create() {
853 return new ContentMainRunnerImpl(); 859 return new ContentMainRunnerImpl();
854 } 860 }
855 861
856 } // namespace content 862 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698