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: content/app/content_main_runner.cc

Issue 594603003: Infrastructure for reading V8's initial snapshot from external files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Properly override v8_use_external_snapshot in v8 Created 6 years, 3 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
13 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/i18n/icu_util.h" 15 #include "base/i18n/icu_util.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) && defined(OS_MACOSX)
19 #include "base/mac/bundle_locations.h"
20 #endif
rmcilroy 2014/09/23 10:04:20 I'm not sure you need this here either?
baixo 2014/09/23 11:36:46 Done.
18 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/scoped_vector.h" 22 #include "base/memory/scoped_vector.h"
20 #include "base/metrics/stats_table.h" 23 #include "base/metrics/stats_table.h"
21 #include "base/path_service.h" 24 #include "base/path_service.h"
22 #include "base/process/launch.h" 25 #include "base/process/launch.h"
23 #include "base/process/memory.h" 26 #include "base/process/memory.h"
24 #include "base/process/process_handle.h" 27 #include "base/process/process_handle.h"
25 #include "base/profiler/alternate_timer.h" 28 #include "base/profiler/alternate_timer.h"
26 #include "base/strings/string_number_conversions.h" 29 #include "base/strings/string_number_conversions.h"
27 #include "base/strings/string_util.h" 30 #include "base/strings/string_util.h"
28 #include "base/strings/stringprintf.h" 31 #include "base/strings/stringprintf.h"
29 #include "content/browser/browser_main.h" 32 #include "content/browser/browser_main.h"
30 #include "content/common/set_process_title.h" 33 #include "content/common/set_process_title.h"
31 #include "content/common/url_schemes.h" 34 #include "content/common/url_schemes.h"
32 #include "content/gpu/in_process_gpu_thread.h" 35 #include "content/gpu/in_process_gpu_thread.h"
33 #include "content/public/app/content_main.h" 36 #include "content/public/app/content_main.h"
34 #include "content/public/app/content_main_delegate.h" 37 #include "content/public/app/content_main_delegate.h"
35 #include "content/public/app/startup_helper_win.h" 38 #include "content/public/app/startup_helper_win.h"
36 #include "content/public/browser/content_browser_client.h" 39 #include "content/public/browser/content_browser_client.h"
37 #include "content/public/common/content_client.h" 40 #include "content/public/common/content_client.h"
38 #include "content/public/common/content_constants.h" 41 #include "content/public/common/content_constants.h"
39 #include "content/public/common/content_paths.h" 42 #include "content/public/common/content_paths.h"
40 #include "content/public/common/content_switches.h" 43 #include "content/public/common/content_switches.h"
41 #include "content/public/common/main_function_params.h" 44 #include "content/public/common/main_function_params.h"
42 #include "content/public/common/sandbox_init.h" 45 #include "content/public/common/sandbox_init.h"
43 #include "content/renderer/in_process_renderer_thread.h" 46 #include "content/renderer/in_process_renderer_thread.h"
44 #include "content/utility/in_process_utility_thread.h" 47 #include "content/utility/in_process_utility_thread.h"
45 #include "crypto/nss_util.h" 48 #include "crypto/nss_util.h"
49 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
50 #include "gin/public/isolate_holder.h"
51 #endif // V8_USE_EXTERNAL_STARTUP_DATA
46 #include "ipc/ipc_descriptors.h" 52 #include "ipc/ipc_descriptors.h"
47 #include "ipc/ipc_switches.h" 53 #include "ipc/ipc_switches.h"
48 #include "media/base/media.h" 54 #include "media/base/media.h"
49 #include "sandbox/win/src/sandbox_types.h" 55 #include "sandbox/win/src/sandbox_types.h"
50 #include "ui/base/ui_base_paths.h" 56 #include "ui/base/ui_base_paths.h"
51 #include "ui/base/ui_base_switches.h" 57 #include "ui/base/ui_base_switches.h"
52 58
53 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
54 #include "content/public/common/content_descriptors.h" 60 #include "content/public/common/content_descriptors.h"
55 #endif 61 #endif
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 RegisterPathProvider(); 714 RegisterPathProvider();
709 RegisterContentSchemes(true); 715 RegisterContentSchemes(true);
710 716
711 #if defined(OS_ANDROID) 717 #if defined(OS_ANDROID)
712 int icudata_fd = base::GlobalDescriptors::GetInstance()->MaybeGet( 718 int icudata_fd = base::GlobalDescriptors::GetInstance()->MaybeGet(
713 kAndroidICUDataDescriptor); 719 kAndroidICUDataDescriptor);
714 if (icudata_fd != -1) 720 if (icudata_fd != -1)
715 CHECK(base::i18n::InitializeICUWithFileDescriptor(icudata_fd)); 721 CHECK(base::i18n::InitializeICUWithFileDescriptor(icudata_fd));
716 else 722 else
717 CHECK(base::i18n::InitializeICU()); 723 CHECK(base::i18n::InitializeICU());
724
725 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
726 int v8_natives_fd = base::GlobalDescriptors::GetInstance()->MaybeGet(
727 kV8NativesDataDescriptor);
728 int v8_snapshot_fd = base::GlobalDescriptors::GetInstance()->MaybeGet(
729 kV8SnapshotDataDescriptor);
730 if (v8_natives_fd != -1 && v8_snapshot_fd != -1)
731 CHECK(gin::IsolateHolder::LoadV8SnapshotFD(v8_natives_fd,
732 v8_snapshot_fd));
733 else
734 CHECK(gin::IsolateHolder::LoadV8Snapshot());
735 #endif // V8_USE_EXTERNAL_STARTUP_DATA
718 #else 736 #else
rmcilroy 2014/09/23 10:04:20 nit - newline before the #else
baixo 2014/09/23 11:36:46 Done.
719 CHECK(base::i18n::InitializeICU()); 737 CHECK(base::i18n::InitializeICU());
720 #endif 738 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
739 CHECK(gin::IsolateHolder::LoadV8Snapshot());
740 #endif // V8_USE_EXTERNAL_STARTUP_DATA
741 #endif // OS_ANDROID
721 742
722 InitializeStatsTable(command_line); 743 InitializeStatsTable(command_line);
723 744
724 if (delegate_) 745 if (delegate_)
725 delegate_->PreSandboxStartup(); 746 delegate_->PreSandboxStartup();
726 747
727 if (!process_type.empty()) 748 if (!process_type.empty())
728 CommonSubprocessInit(process_type); 749 CommonSubprocessInit(process_type);
729 750
730 #if defined(OS_WIN) 751 #if defined(OS_WIN)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 847
827 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 848 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
828 }; 849 };
829 850
830 // static 851 // static
831 ContentMainRunner* ContentMainRunner::Create() { 852 ContentMainRunner* ContentMainRunner::Create() {
832 return new ContentMainRunnerImpl(); 853 return new ContentMainRunnerImpl();
833 } 854 }
834 855
835 } // namespace content 856 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698