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

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: Remove debug logging 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 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 // Map V8 data from within .apk.
720 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors(
721 kV8NativesDataDescriptor, gin::V8Initializer::kNativesFileName));
Yaron 2015/05/25 18:56:44 Isn't this introducing new blocking IO on the main
722 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors(
723 kV8SnapshotDataDescriptor, gin::V8Initializer::kSnapshotFileName));
724 #else
715 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared 725 // kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared
716 // with child processes via file descriptors. On Android they are set in 726 // with child processes via file descriptors. On Android they are set in
Yaron 2015/05/25 18:56:44 update
717 // ChildProcessService::InternalInitChildProcess, otherwise set them here. 727 // ChildProcessService::InternalInitChildProcess, otherwise set them here.
718 if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) { 728 if (command_line.HasSwitch(switches::kV8NativesPassedByFD)) {
719 g_fds->Set( 729 g_fds->Set(
720 kV8NativesDataDescriptor, 730 kV8NativesDataDescriptor,
721 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); 731 kV8NativesDataDescriptor + base::GlobalDescriptors::kBaseDescriptor);
722 } 732 }
723 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) { 733 if (command_line.HasSwitch(switches::kV8SnapshotPassedByFD)) {
724 g_fds->Set( 734 g_fds->Set(
725 kV8SnapshotDataDescriptor, 735 kV8SnapshotDataDescriptor,
726 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor); 736 kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor);
727 } 737 }
728 #endif // !OS_ANDROID 738 #endif // OS_ANDROID
729 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor); 739 int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor);
730 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor); 740 int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor);
731 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) { 741 if (v8_natives_fd != -1 && v8_snapshot_fd != -1) {
732 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor); 742 auto v8_natives_region = g_fds->GetRegion(kV8NativesDataDescriptor);
733 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor); 743 auto v8_snapshot_region = g_fds->GetRegion(kV8SnapshotDataDescriptor);
734 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD( 744 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD(
735 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size, 745 v8_natives_fd, v8_natives_region.offset, v8_natives_region.size,
736 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size)); 746 v8_snapshot_fd, v8_snapshot_region.offset, v8_snapshot_region.size));
737 } else { 747 } else {
738 CHECK(gin::V8Initializer::LoadV8Snapshot()); 748 CHECK(gin::V8Initializer::LoadV8Snapshot());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 857
848 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 858 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
849 }; 859 };
850 860
851 // static 861 // static
852 ContentMainRunner* ContentMainRunner::Create() { 862 ContentMainRunner* ContentMainRunner::Create() {
853 return new ContentMainRunnerImpl(); 863 return new ContentMainRunnerImpl();
854 } 864 }
855 865
856 } // namespace content 866 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698