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

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

Issue 1156873002: Load v8 snapshots directly from APK (and store them uncompressed) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8initializer
Patch Set: fix webview, content shell, chromecast 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 | « chromecast/chromecast.gyp ('k') | content/content_shell.gypi » ('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 (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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "content/renderer/in_process_renderer_thread.h" 44 #include "content/renderer/in_process_renderer_thread.h"
45 #include "content/utility/in_process_utility_thread.h" 45 #include "content/utility/in_process_utility_thread.h"
46 #include "crypto/nss_util.h" 46 #include "crypto/nss_util.h"
47 #include "ipc/ipc_descriptors.h" 47 #include "ipc/ipc_descriptors.h"
48 #include "ipc/ipc_switches.h" 48 #include "ipc/ipc_switches.h"
49 #include "media/base/media.h" 49 #include "media/base/media.h"
50 #include "sandbox/win/src/sandbox_types.h" 50 #include "sandbox/win/src/sandbox_types.h"
51 #include "ui/base/ui_base_paths.h" 51 #include "ui/base/ui_base_paths.h"
52 #include "ui/base/ui_base_switches.h" 52 #include "ui/base/ui_base_switches.h"
53 53
54 #if defined(OS_ANDROID)
55 #include "base/android/apk_assets.h"
56 #endif
57
54 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 58 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
55 #include "gin/v8_initializer.h" 59 #include "gin/v8_initializer.h"
56 #endif 60 #endif
57 61
58 #if defined(USE_TCMALLOC) 62 #if defined(USE_TCMALLOC)
59 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" 63 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h"
60 #if defined(TYPE_PROFILING) 64 #if defined(TYPE_PROFILING)
61 #include "base/allocator/type_profiler.h" 65 #include "base/allocator/type_profiler.h"
62 #include "base/allocator/type_profiler_tcmalloc.h" 66 #include "base/allocator/type_profiler_tcmalloc.h"
63 #endif 67 #endif
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 CHECK(base::i18n::InitializeICU()); 708 CHECK(base::i18n::InitializeICU());
705 } 709 }
706 #else 710 #else
707 CHECK(base::i18n::InitializeICU()); 711 CHECK(base::i18n::InitializeICU());
708 #endif // OS_ANDROID 712 #endif // OS_ANDROID
709 713
710 base::StatisticsRecorder::Initialize(); 714 base::StatisticsRecorder::Initialize();
711 715
712 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 716 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
713 #if defined(OS_POSIX) && !defined(OS_MACOSX) 717 #if defined(OS_POSIX) && !defined(OS_MACOSX)
714 #if !defined(OS_ANDROID) 718 #if defined(OS_ANDROID)
719 // The fds are already mapped in the case of Android WebView.
rmcilroy 2015/05/26 09:15:14 Webview? Please update the comment. Also, where h
720 if (g_fds->MaybeGet(kV8NativesDataDescriptor) == -1) {
rmcilroy 2015/05/26 09:15:14 Please use the switches::kV8NativesPassedByFD and
721 // Map V8 data from within .apk.
722 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors(
723 kV8NativesDataDescriptor, gin::V8Initializer::kNativesFileName));
724 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors(
725 kV8SnapshotDataDescriptor, gin::V8Initializer::kSnapshotFileName));
726 }
727 #else
715 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared 728 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared
716 // with child processes via file descriptors. On Android they are set in 729 // with child processes via file descriptors. On Android they are set in
717 // ChildProcessService::InternalInitChildProcess, otherwise set them here. 730 // ChildProcessService::InternalInitChildProcess, otherwise set them here.
718 if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) { 731 if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) {
719 g_fds->Set( 732 g_fds->Set(
720 kV8NativesDataDescriptor, 733 kV8NativesDataDescriptor,
721 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); 734 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor);
722 } 735 }
723 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { 736 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) {
724 g_fds->Set( 737 g_fds->Set(
725 kV8SnapshotDataDescriptor, 738 kV8SnapshotDataDescriptor,
726 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); 739 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor);
727 } 740 }
728 #endif // !OS_ANDROID 741 #endif // OS_ANDROID
729 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); 742 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor);
730 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); 743 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor);
731 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) { 744 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) {
732 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); 745 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor);
733 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); 746 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor);
734 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD( 747 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD(
735 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size, 748 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size,
736 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size)); 749 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size));
737 } else { 750 } else {
738 CHECK(gin::V8Initializer::LoadV8Snapshot()); 751 CHECK(gin::V8Initializer::LoadV8Snapshot());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 860
848 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 861 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
849 }; 862 };
850 863
851 // static 864 // static
852 ContentMainRunner* ContentMainRunner::Create() { 865 ContentMainRunner* ContentMainRunner::Create() {
853 return new ContentMainRunnerImpl(); 866 return new ContentMainRunnerImpl();
854 } 867 }
855 868
856 } // namespace content 869 } // namespace content
OLDNEW
« no previous file with comments | « chromecast/chromecast.gyp ('k') | content/content_shell.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698