diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-12 21:14:44 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-12 21:14:44 +0000 |
commit | 93156cecb487ad7f1d7e307618cd58bd6546da29 (patch) | |
tree | ab60b7a310d1f8b2abae34e0b7c7703cf4dd2ced | |
parent | fd5633b12e0ed15c62e6e0001b52bd53b895299c (diff) | |
download | chromium_src-93156cecb487ad7f1d7e307618cd58bd6546da29.zip chromium_src-93156cecb487ad7f1d7e307618cd58bd6546da29.tar.gz chromium_src-93156cecb487ad7f1d7e307618cd58bd6546da29.tar.bz2 |
Make the NaCl windows 64 bit binaries not depend on chrome targets. These targets are very simple and used little code from chrome targets. However their dependency on chrome targets was problematic because a lot of code wasn't being built for 64 bit on Windows, and so there were a lot of "dummy" files being added with stub functions and code was also being compiled out in random places for NACL_WIN64.
I've made the NaCl 64 bit windows targets self contained. They do use a few files from common, but those files are self-contained. In the future, we could move these to be in the same 64 bit target as the constants from common. However that won't make a maintenance difference since someone could still introduce link dependencies to other files in common.
Additionally, since we're not using chrome code anymore, we can avoid having both nacl.exe and nacl.dll. nacl.exe is sufficient, and this saves 1.4MB of uncompresed binaries in the installer.
BUG=86322
Review URL: http://codereview.chromium.org/7863024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100767 0039d316-1c4b-4281-b951-d872f2087c98
49 files changed, 461 insertions, 998 deletions
diff --git a/chrome/app/chrome_exe_main_win.cc b/chrome/app/chrome_exe_main_win.cc index 659ce16..8d53054 100644 --- a/chrome/app/chrome_exe_main_win.cc +++ b/chrome/app/chrome_exe_main_win.cc @@ -9,7 +9,7 @@ #include "base/command_line.h" #include "chrome/app/breakpad_win.h" #include "chrome/app/client_util.h" -#include "content/app/sandbox_helper_win.h" +#include "content/app/startup_helper_win.h" #include "content/common/result_codes.h" #include "sandbox/src/sandbox_factory.h" diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc index 0bedac4..8b69e3f 100644 --- a/chrome/app/chrome_main.cc +++ b/chrome/app/chrome_main.cc @@ -89,28 +89,21 @@ #include "chrome/app/breakpad_linux.h" #endif -#if !defined(NACL_WIN64) // We don't build the this code on win nacl64. base::LazyInstance<chrome::ChromeContentBrowserClient> g_chrome_content_browser_client(base::LINKER_INITIALIZED); base::LazyInstance<chrome::ChromeContentRendererClient> g_chrome_content_renderer_client(base::LINKER_INITIALIZED); base::LazyInstance<chrome::ChromeContentUtilityClient> g_chrome_content_utility_client(base::LINKER_INITIALIZED); -#endif // NACL_WIN64 - base::LazyInstance<chrome::ChromeContentPluginClient> g_chrome_content_plugin_client(base::LINKER_INITIALIZED); extern int RendererMain(const MainFunctionParams&); extern int NaClMain(const MainFunctionParams&); extern int ProfileImportMain(const MainFunctionParams&); -#if defined(_WIN64) -extern int NaClBrokerMain(const MainFunctionParams&); -#endif extern int ServiceProcessMain(const MainFunctionParams&); #if defined(OS_WIN) -// TODO(erikkay): isn't this already defined somewhere? #define DLLEXPORT __declspec(dllexport) // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. @@ -271,18 +264,14 @@ void EnableHeapProfiler(const CommandLine& command_line) { } void InitializeChromeContentRendererClient() { -#if !defined(NACL_WIN64) // We don't build the renderer code on win nacl64. content::GetContentClient()->set_renderer( &g_chrome_content_renderer_client.Get()); -#endif } void InitializeChromeContentClient(const std::string& process_type) { if (process_type.empty()) { -#if !defined(NACL_WIN64) // We don't build the this code on win nacl64. content::GetContentClient()->set_browser( &g_chrome_content_browser_client.Get()); -#endif } else if (process_type == switches::kPluginProcess) { content::GetContentClient()->set_plugin( &g_chrome_content_plugin_client.Get()); @@ -290,10 +279,8 @@ void InitializeChromeContentClient(const std::string& process_type) { process_type == switches::kExtensionProcess) { InitializeChromeContentRendererClient(); } else if (process_type == switches::kUtilityProcess) { -#if !defined(NACL_WIN64) // We don't build this code on win nacl64. content::GetContentClient()->set_utility( &g_chrome_content_utility_client.Get()); -#endif } } @@ -668,9 +655,6 @@ class ChromeMainDelegate : public content::ContentMainDelegate { #endif #if !defined(DISABLE_NACL) { switches::kNaClLoaderProcess, NaClMain }, -#if defined(_WIN64) // The broker process is used only on Win64. - { switches::kNaClBrokerProcess, NaClBrokerMain }, -#endif #endif // DISABLE_NACL }; diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc index 06a1e99..79d92d1 100644 --- a/chrome/app/client_util.cc +++ b/chrome/app/client_util.cc @@ -168,21 +168,7 @@ bool GetPreReadExperimentGroup(DWORD* pre_read) { HMODULE LoadChromeWithDirectory(std::wstring* dir) { ::SetCurrentDirectoryW(dir->c_str()); const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); -#ifdef _WIN64 - if ((cmd_line.GetSwitchValueASCII(switches::kProcessType) == - switches::kNaClBrokerProcess) || - (cmd_line.GetSwitchValueASCII(switches::kProcessType) == - switches::kNaClLoaderProcess)) { - // Load the 64-bit DLL when running in a 64-bit process. - dir->append(installer::kChromeNaCl64Dll); - } else { - // Only NaCl broker and loader can be launched as Win64 processes. - NOTREACHED(); - return NULL; - } -#else dir->append(installer::kChromeDll); -#endif #ifndef WIN_DISABLE_PREREAD #ifdef NDEBUG diff --git a/chrome/app/dummy_main_functions.cc b/chrome/app/dummy_main_functions.cc deleted file mode 100644 index 4240564..0000000 --- a/chrome/app/dummy_main_functions.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/chrome_result_codes.h" -#include "content/common/main_function_params.h" - -// Native Client binary for 64-bit Windows can run only the NaCl loader or -// the sandbox broker processes. Other process types are not supported. -int BrowserMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int RendererMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int PluginMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int PpapiPluginMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int PpapiBrokerMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int WorkerMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int UtilityMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int ProfileImportMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int ZygoteMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int DiagnosticsMain(const CommandLine& command_line) { - return 1; -} - -int GpuMain(const MainFunctionParams&) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} - -int ServiceProcessMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} diff --git a/chrome/app/nacl64_dll.ver b/chrome/app/nacl64_dll.ver deleted file mode 100644 index 998c4a2..0000000 --- a/chrome/app/nacl64_dll.ver +++ /dev/null @@ -1,2 +0,0 @@ -INTERNAL_NAME=nacl64_dll -ORIGINAL_FILENAME=nacl64.dll diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.cc b/chrome/browser/nacl_host/nacl_broker_host_win.cc index ed16610..dc1bb7f 100644 --- a/chrome/browser/nacl_host/nacl_broker_host_win.cc +++ b/chrome/browser/nacl_host/nacl_broker_host_win.cc @@ -11,6 +11,7 @@ #include "chrome/browser/nacl_host/nacl_process_host.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/logging_chrome.h" #include "chrome/common/nacl_cmd_line.h" #include "chrome/common/nacl_messages.h" @@ -38,8 +39,9 @@ bool NaClBrokerHost::Init() { cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kNaClBrokerProcess); - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); + if (logging::DialogsAreSuppressed()) + cmd_line->AppendSwitch(switches::kNoErrorDialogs); BrowserChildProcessHost::Launch(FilePath(), cmd_line); return true; diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index cb2f3a9..62e1b85 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -169,8 +169,9 @@ bool NaClProcessHost::LaunchSelLdr() { cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kNaClLoaderProcess); - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); + if (logging::DialogsAreSuppressed()) + cmd_line->AppendSwitch(switches::kNoErrorDialogs); if (!nacl_loader_prefix.empty()) cmd_line->PrependWrapper(nacl_loader_prefix); diff --git a/chrome/browser/renderer_host/render_process_host_dummy.cc b/chrome/browser/renderer_host/render_process_host_dummy.cc deleted file mode 100644 index a15f637..0000000 --- a/chrome/browser/renderer_host/render_process_host_dummy.cc +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -#include "content/browser/renderer_host/render_process_host.h" - -bool RenderProcessHost::run_renderer_in_process_ = false; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 2c45c1c..7ef735e 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -36,13 +36,6 @@ '../printing/printing.gyp:printing', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:inspector_resources', ], - 'nacl_win64_dependencies': [ - 'common_nacl_win64', - 'common_constants_win64', - 'installer_util_nacl_win64', - '../base/base.gyp:base_static_win64', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', - ], 'allocator_target': '../base/allocator/allocator.gyp:allocator', 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', 'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out', @@ -1395,7 +1388,6 @@ 'app/chrome_exe.ver', 'app/chrome_dll.ver', 'app/nacl64_exe.ver', - 'app/nacl64_dll.ver', 'app/other.ver', ], 'rules': [ @@ -1555,7 +1547,6 @@ 'type': 'executable', 'product_name': 'crash_service64', 'dependencies': [ - 'app/policy/cloud_policy_codegen.gyp:policy_win64', 'common_constants_win64', 'installer_util_nacl_win64', '../base/base.gyp:base_static_win64', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index ab91337..c107ee2 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -3,80 +3,6 @@ # found in the LICENSE file. { - 'target_defaults': { - 'variables': { - 'chrome_common_target': 0, - }, - 'target_conditions': [ - ['chrome_common_target==1', { - 'include_dirs': [ - '..', - ], - 'conditions': [ - ['OS=="win"', { - 'include_dirs': [ - '<(DEPTH)/third_party/wtl/include', - ], - }], - ], - 'sources': [ - # .cc, .h, and .mm files under chrome/common that are used on all - # platforms, including both 32-bit and 64-bit Windows. - # Test files are not included. - 'common/about_handler.cc', - 'common/about_handler.h', - 'common/attrition_experiments.h', - 'common/auto_start_linux.cc', - 'common/auto_start_linux.h', - 'common/autofill_messages.h', - 'common/child_process_logging.h', - 'common/child_process_logging_linux.cc', - 'common/child_process_logging_mac.mm', - 'common/child_process_logging_win.cc', - 'common/chrome_notification_types.h', - 'common/chrome_version_info.cc', - 'common/chrome_version_info_linux.cc', - 'common/chrome_version_info_mac.mm', - 'common/chrome_version_info_win.cc', - 'common/chrome_version_info.h', - 'common/content_settings.cc', - 'common/content_settings.h', - 'common/content_settings_helper.cc', - 'common/content_settings_helper.h', - 'common/content_settings_types.h', - 'common/external_ipc_fuzzer.h', - 'common/external_ipc_fuzzer.cc', - 'common/guid.cc', - 'common/guid.h', - 'common/guid_posix.cc', - 'common/guid_win.cc', - 'common/icon_messages.h', - 'common/instant_types.h', - 'common/logging_chrome.cc', - 'common/logging_chrome.h', - 'common/metrics_helpers.cc', - 'common/metrics_helpers.h', - 'common/multi_process_lock.h', - 'common/multi_process_lock_linux.cc', - 'common/multi_process_lock_mac.cc', - 'common/multi_process_lock_win.cc', - 'common/nacl_cmd_line.cc', - 'common/nacl_cmd_line.h', - 'common/nacl_messages.cc', - 'common/nacl_messages.h', - 'common/nacl_types.h', - 'common/profiling.cc', - 'common/profiling.h', - 'common/ref_counted_util.h', - 'common/safe_browsing/safebrowsing_messages.h', - 'common/switch_utils.cc', - 'common/switch_utils.h', - 'common/time_format.cc', - 'common/time_format.h', - ], - }], - ], - }, 'targets': [ { 'target_name': 'common', @@ -84,8 +10,9 @@ 'variables': { 'chrome_common_target': 1, }, - # TODO(gregoryd): This could be shared with the 64-bit target, but - # it does not work due to a gyp issue. + 'include_dirs': [ + '..', + ], 'direct_dependent_settings': { 'include_dirs': [ '..', @@ -123,8 +50,12 @@ '../webkit/support/webkit_support.gyp:glue', ], 'sources': [ - # .cc, .h, and .mm files under chrome/common that are not required for - # building 64-bit Windows targets. Test files are not included. + 'common/about_handler.cc', + 'common/about_handler.h', + 'common/attrition_experiments.h', + 'common/auto_start_linux.cc', + 'common/auto_start_linux.h', + 'common/autofill_messages.h', 'common/automation_constants.cc', 'common/automation_constants.h', 'common/automation_messages.cc', @@ -133,11 +64,21 @@ 'common/badge_util.cc', 'common/badge_util.h', 'common/bzip2_error_handler.cc', + 'common/child_process_logging.h', + 'common/child_process_logging_linux.cc', + 'common/child_process_logging_mac.mm', + 'common/child_process_logging_win.cc', 'common/chrome_content_client.cc', 'common/chrome_content_client.h', 'common/chrome_content_plugin_client.cc', 'common/chrome_content_plugin_client.h', + 'common/chrome_notification_types.h', 'common/chrome_plugin_messages.h', + 'common/chrome_version_info.cc', + 'common/chrome_version_info_linux.cc', + 'common/chrome_version_info_mac.mm', + 'common/chrome_version_info_win.cc', + 'common/chrome_version_info.h', 'common/cloud_print/cloud_print_proxy_info.cc', 'common/cloud_print/cloud_print_proxy_info.h', 'common/common_api.h', @@ -145,6 +86,11 @@ 'common/common_message_generator.h', 'common/common_param_traits.cc', 'common/common_param_traits.h', + 'common/content_settings.cc', + 'common/content_settings.h', + 'common/content_settings_helper.cc', + 'common/content_settings_helper.h', + 'common/content_settings_types.h', 'common/custom_handlers/protocol_handler.cc', 'common/custom_handlers/protocol_handler.h', 'common/default_plugin.cc', @@ -190,16 +136,26 @@ 'common/extensions/url_pattern_set.h', 'common/extensions/user_script.cc', 'common/extensions/user_script.h', + 'common/external_ipc_fuzzer.h', + 'common/external_ipc_fuzzer.cc', 'common/favicon_url.cc', 'common/favicon_url.h', + 'common/guid.cc', + 'common/guid.h', + 'common/guid_posix.cc', + 'common/guid_win.cc', + 'common/icon_messages.h', 'common/important_file_writer.cc', 'common/important_file_writer.h', + 'common/instant_types.h', 'common/json_pref_store.cc', 'common/json_pref_store.h', 'common/json_schema_validator.cc', 'common/json_schema_validator.h', 'common/jstemplate_builder.cc', 'common/jstemplate_builder.h', + 'common/logging_chrome.cc', + 'common/logging_chrome.h', 'common/mac/app_mode_common.h', 'common/mac/app_mode_common.mm', 'common/mac/cfbundle_blocker.h', @@ -210,6 +166,17 @@ 'common/mac/objc_method_swizzle.mm', 'common/mac/objc_zombie.h', 'common/mac/objc_zombie.mm', + 'common/metrics_helpers.cc', + 'common/metrics_helpers.h', + 'common/multi_process_lock.h', + 'common/multi_process_lock_linux.cc', + 'common/multi_process_lock_mac.cc', + 'common/multi_process_lock_win.cc', + 'common/nacl_cmd_line.cc', + 'common/nacl_cmd_line.h', + 'common/nacl_messages.cc', + 'common/nacl_messages.h', + 'common/nacl_types.h', 'common/libxml_utils.cc', 'common/libxml_utils.h', 'common/native_window_notification_source.h', @@ -218,10 +185,14 @@ 'common/pref_store.h', 'common/print_messages.cc', 'common/print_messages.h', + 'common/profiling.cc', + 'common/profiling.h', 'common/random.cc', 'common/random.h', + 'common/ref_counted_util.h', 'common/render_messages.cc', 'common/render_messages.h', + 'common/safe_browsing/safebrowsing_messages.h', 'common/scoped_co_mem.h', 'common/search_provider.h', 'common/service_messages.h', @@ -235,8 +206,12 @@ 'common/spellcheck_common.cc', 'common/spellcheck_common.h', 'common/spellcheck_messages.h', + 'common/switch_utils.cc', + 'common/switch_utils.h', 'common/thumbnail_score.cc', 'common/thumbnail_score.h', + 'common/time_format.cc', + 'common/time_format.h', 'common/url_constants.cc', 'common/url_constants.h', 'common/visitedlink_common.cc', @@ -251,6 +226,11 @@ 'common/zip.h', ], 'conditions': [ + ['OS=="win"', { + 'include_dirs': [ + '<(DEPTH)/third_party/wtl/include', + ], + }], ['toolkit_uses_gtk == 1', { 'dependencies': [ '../build/linux/system.gyp:gtk', @@ -429,73 +409,4 @@ 'includes': [ '../build/protoc.gypi' ], }, ], - 'conditions': [ - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'common_nacl_win64', - 'type': 'static_library', - 'variables': { - 'chrome_common_target': 1, - }, - 'dependencies': [ - # TODO(gregoryd): chrome_resources and chrome_strings could be - # shared with the 32-bit target, but it does not work due to a gyp - # issue. - 'chrome_resources', - 'chrome_strings', - 'common_constants_win64', - 'app/policy/cloud_policy_codegen.gyp:policy_win64', - '../base/base.gyp:base_nacl_win64', - '../ipc/ipc.gyp:ipc_win64', - '../third_party/libxml/libxml.gyp:libxml', - '../ui/ui.gyp:ui_nacl_win64', - '../ui/ui.gyp:ui_resources', - '../ui/ui.gyp:ui_resources_standard', - ], - 'include_dirs': [ - '../third_party/icu/public/i18n', - '../third_party/icu/public/common', - # We usually get these skia directories by adding a dependency on - # skia, bu we don't need it for NaCl's 64-bit Windows support. The - # directories are required for resolving the includes in any case. - '../third_party/skia/include/config', - '../third_party/skia/include/core', - '../skia/config', - '../skia/config/win', - ], - 'defines': [ - '<@(nacl_win64_defines)', - ], - 'sources': [ - '../webkit/glue/webkit_glue_dummy.cc', - 'common/url_constants.cc', - # TODO(bradnelson): once automatic generation of 64 bit targets on - # Windows is ready, take this out and add a dependency on - # content_common.gypi. - '../content/common/file_system/file_system_dispatcher_dummy.cc', - '../content/common/message_router.cc', - '../content/common/quota_dispatcher_dummy.cc', - '../content/common/resource_dispatcher_dummy.cc', - '../content/common/socket_stream_dispatcher_dummy.cc', - ], - 'export_dependent_settings': [ - 'app/policy/cloud_policy_codegen.gyp:policy_win64', - ], - # TODO(gregoryd): This could be shared with the 32-bit target, but - # it does not work due to a gyp issue. - 'direct_dependent_settings': { - 'include_dirs': [ - '..', - ], - }, - 'configurations': { - 'Common_Base': { - 'msvs_target_platform': 'x64', - }, - }, - }, - ], - }], - ], } diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 24b968c..5dda655 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -2,69 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { - 'target_defaults': { - 'variables': { - 'chrome_dll_target': 0, - }, - 'target_conditions': [ - ['chrome_dll_target==1', { - 'conditions': [ - ['OS=="win"', { - 'include_dirs': [ - '<(DEPTH)/third_party/wtl/include', - ], - 'defines': [ - 'CHROME_DLL', - 'BROWSER_DLL', - 'RENDERER_DLL', - 'PLUGIN_DLL', - ], - 'msvs_settings': { - 'VCLinkerTool': { - 'BaseAddress': '0x01c30000', - 'DelayLoadDLLs': [ - 'comdlg32.dll', - 'crypt32.dll', - 'cryptui.dll', - 'dhcpcsvc.dll', - 'imagehlp.dll', - 'imm32.dll', - 'iphlpapi.dll', - 'setupapi.dll', - 'urlmon.dll', - 'winhttp.dll', - 'wininet.dll', - 'winspool.drv', - 'ws2_32.dll', - 'wsock32.dll', - ], - # Set /SUBSYSTEM:WINDOWS for chrome.dll (for consistency). - 'SubSystem': '2', - }, - 'VCManifestTool': { - 'AdditionalManifestFiles': '$(ProjectDir)\\app\\chrome.dll.manifest', - }, - }, - 'configurations': { - 'Debug_Base': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', - }, - }, - }, - }, - }], # OS=="win" - ], # conditions - }], - ], - }, 'conditions': [ ['OS=="mac" or OS=="win"', { 'targets': [ { 'variables': { - 'chrome_dll_target': 1, 'conditions' : [ ['OS=="win" and optimize_with_syzygy==1', { # On Windows we use build chrome_dll as an intermediate target @@ -142,10 +84,31 @@ #'app/check_dependents.bat', #'app/chrome.dll.deps', ], - 'msvs_settings': { + 'include_dirs': [ + '<(DEPTH)/third_party/wtl/include', + ], + 'defines': [ + 'CHROME_DLL', + 'BROWSER_DLL', + 'RENDERER_DLL', + 'PLUGIN_DLL', + ], + 'configurations': { + 'Debug_Base': { + 'msvs_settings': { + 'VCLinkerTool': { + 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', + }, + }, + }, + }, + 'msvs_settings': { 'VCLinkerTool': { + 'BaseAddress': '0x01c30000', 'ImportLibrary': '$(OutDir)\\lib\\chrome_dll.lib', 'ProgramDatabaseFile': '$(OutDir)\\chrome_dll.pdb', + # Set /SUBSYSTEM:WINDOWS for chrome.dll (for consistency). + 'SubSystem': '2', 'conditions': [ ['optimize_with_syzygy==1', { # When syzygy is enabled we use build chrome_dll as an @@ -158,6 +121,25 @@ 'UseLibraryDependencyInputs': "true", }], ], + 'DelayLoadDLLs': [ + 'comdlg32.dll', + 'crypt32.dll', + 'cryptui.dll', + 'dhcpcsvc.dll', + 'imagehlp.dll', + 'imm32.dll', + 'iphlpapi.dll', + 'setupapi.dll', + 'urlmon.dll', + 'winhttp.dll', + 'wininet.dll', + 'winspool.drv', + 'ws2_32.dll', + 'wsock32.dll', + ], + }, + 'VCManifestTool': { + 'AdditionalManifestFiles': '$(ProjectDir)\\app\\chrome.dll.manifest', }, }, 'conditions': [ @@ -654,104 +636,5 @@ }, # target chrome_dll ], # targets }], # OS=="mac" or OS=="win" - [ 'OS=="win"', { - 'targets': [ - { - 'target_name': 'chrome_dll_nacl_win64', - 'type': 'shared_library', - 'product_name': 'nacl64', - 'variables': { - 'chrome_dll_target': 1, - }, - 'include_dirs': [ - '..', - ], - 'dependencies': [ - '<@(nacl_win64_dependencies)', - 'chrome_version_resources', - 'nacl_win64', - '../base/base.gyp:base_i18n_nacl_win64', - ], - 'defines': [ - '<@(nacl_win64_defines)', - # Required to build gl_switches.cc as part of this binary. - 'GL_IMPLEMENTATION' - ], - 'sources': [ - 'app/chrome_command_ids.h', - 'app/chrome_dll_resource.h', - 'app/chrome_main.cc', - # Parsing is needed for the UserDataDir policy which is read much - # earlier than the initialization of the policy/pref system. - 'browser/policy/policy_path_parser_win.cc', - 'browser/renderer_host/render_process_host_dummy.cc', - 'common/googleurl_dummy.cc', - - '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_dll_version.rc', - - # TODO: It would be nice to have these pulled in - # automatically from direct_dependent_settings in - # their various targets (net.gyp:net_resources, etc.), - # but that causes errors in other targets when - # resulting .res files get referenced multiple times. - '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc', - - # TODO(sgk): left-over from pre-gyp build, figure out - # if we still need them and/or how to update to gyp. - #'app/check_dependents.bat', - #'app/chrome.dll.deps', - - # Stub entry points for process types that are not supported - # by NaCl Win64 executable - 'app/dummy_main_functions.cc', - - # TODO(bradnelson): once automatic generation of 64 bit targets on - # Windows is ready, take this out and add a dependency on - # content_common.gypi and common.gypi in nacl_win64_dependencies - # and get rid of the common_constants.gypi which was added as a hack - # to avoid making common compile on 64 bit on Windows. - '../chrome/common/chrome_content_client.cc', - '../chrome/common/chrome_content_plugin_client.cc', - '../content/app/content_main.cc', - '../content/common/child_process.cc', - '../content/common/child_thread.cc', - '../content/common/content_client.cc', - '../content/common/content_constants.cc', - '../content/common/content_counters.cc', - '../content/common/content_message_generator.cc', - '../content/common/content_paths.cc', - '../content/common/content_switches.cc', - '../content/common/debug_flags.cc', - '../content/common/hi_res_timer_manager_win.cc', - '../content/common/notification_details.cc', - '../content/common/notification_service.cc', - '../content/common/notification_source.cc', - '../content/common/sandbox_policy.cc', - '../content/common/sandbox_init_wrapper_win.cc', - '../content/common/url_constants.cc', - '../ui/gfx/gl/gl_switches.cc', - ], - 'msvs_settings': { - 'VCLinkerTool': { - 'ImportLibrary': '$(OutDir)\\lib\\nacl64_dll.lib', - 'ProgramDatabaseFile': '$(OutDir)\\nacl64_dll.pdb', - }, - }, - 'configurations': { - 'Common_Base': { - 'msvs_target_platform': 'x64', - }, - 'Debug_Base': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_debug_link_nonincremental)', - }, - }, - }, - }, - }, # target chrome_dll - ], - }], ], } diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 74445a8..60fecd0 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -3,99 +3,43 @@ # found in the LICENSE file. { - 'target_defaults': { - 'variables': { - 'chrome_exe_target': 0, - }, - 'target_conditions': [ - ['chrome_exe_target==1', { - 'sources': [ - # .cc, .h, and .mm files under app that are used on all - # platforms, including both 32-bit and 64-bit Windows. - # Test files are not included. - 'app/breakpad_win.cc', - 'app/breakpad_win.h', - 'app/chrome_exe_main_gtk.cc', - 'app/chrome_exe_main_mac.cc', - 'app/chrome_exe_main_win.cc', - 'app/chrome_exe_resource.h', - 'app/client_util.cc', - 'app/client_util.h', - 'app/hard_error_handler_win.cc', - 'app/hard_error_handler_win.h', - 'app/scoped_ole_initializer.h', - '../content/app/sandbox_helper_win.cc', - '../content/common/content_switches.cc', - ], - 'mac_bundle_resources': [ - 'app/app-Info.plist', - ], - # TODO(mark): Come up with a fancier way to do this. It should only - # be necessary to list app-Info.plist once, not the three times it is - # listed here. - 'mac_bundle_resources!': [ - 'app/app-Info.plist', - ], - 'xcode_settings': { - 'CHROMIUM_STRIP_SAVE_FILE': 'app/app.saves', - 'INFOPLIST_FILE': 'app/app-Info.plist', - }, - 'conditions': [ - ['OS=="win"', { - 'msvs_settings': { - 'VCLinkerTool': { - 'DelayLoadDLLs': [ - 'dbghelp.dll', - 'dwmapi.dll', - 'uxtheme.dll', - 'ole32.dll', - 'oleaut32.dll', - ], - # Set /SUBSYSTEM:WINDOWS for chrome.exe itself. - 'SubSystem': '2', - }, - 'VCManifestTool': { - 'AdditionalManifestFiles': '$(ProjectDir)\\app\\chrome.exe.manifest', - }, - }, - 'actions': [ - { - 'action_name': 'first_run', - 'inputs': [ - 'app/FirstRun', - ], - 'outputs': [ - '<(PRODUCT_DIR)/First Run', - ], - 'action': ['cp', '-f', '<@(_inputs)', '<@(_outputs)'], - 'message': 'Copy first run complete sentinel file', - }, - ], - }, { # 'OS!="win" - 'sources!': [ - 'app/client_util.cc', - ] - }], - ['OS=="mac" and asan==1', { - 'xcode_settings': { - # Override the outer definition of CHROMIUM_STRIP_SAVE_FILE. - 'CHROMIUM_STRIP_SAVE_FILE': 'app/app_asan.saves', - }, - }], - ], - }], - ], - }, 'targets': [ { 'target_name': 'chrome', 'type': 'executable', 'mac_bundle': 1, 'variables': { - 'chrome_exe_target': 1, 'use_system_xdg_utils%': 0, 'disable_pie%': 0, }, + 'sources': [ + 'app/breakpad_win.cc', + 'app/breakpad_win.h', + 'app/chrome_exe_main_gtk.cc', + 'app/chrome_exe_main_mac.cc', + 'app/chrome_exe_main_win.cc', + 'app/chrome_exe_resource.h', + 'app/client_util.cc', + 'app/client_util.h', + 'app/hard_error_handler_win.cc', + 'app/hard_error_handler_win.h', + 'app/scoped_ole_initializer.h', + '../content/app/startup_helper_win.cc', + '../content/common/content_switches.cc', + ], + 'mac_bundle_resources': [ + 'app/app-Info.plist', + ], + # TODO(mark): Come up with a fancier way to do this. It should only + # be necessary to list app-Info.plist once, not the three times it is + # listed here. + 'mac_bundle_resources!': [ + 'app/app-Info.plist', + ], + 'xcode_settings': { + 'CHROMIUM_STRIP_SAVE_FILE': 'app/app.saves', + 'INFOPLIST_FILE': 'app/app-Info.plist', + }, 'conditions': [ ['os_posix == 1 and OS != "mac"', { 'actions': [ @@ -470,6 +414,12 @@ 'chrome_dll', ], }], + ['OS=="mac" and asan==1', { + 'xcode_settings': { + # Override the outer definition of CHROMIUM_STRIP_SAVE_FILE. + 'CHROMIUM_STRIP_SAVE_FILE': 'app/app_asan.saves', + }, + }], ['OS=="win"', { 'conditions': [ ['optimize_with_syzygy==1', { @@ -483,8 +433,6 @@ 'dependencies': ['chrome_dll',] }], ], - }], - ['OS=="win"', { 'dependencies': [ 'chrome_version_resources', 'installer_util', @@ -503,8 +451,37 @@ 'VCLinkerTool': { 'ImportLibrary': '$(OutDir)\\lib\\chrome_exe.lib', 'ProgramDatabaseFile': '$(OutDir)\\chrome_exe.pdb', + 'DelayLoadDLLs': [ + 'dbghelp.dll', + 'dwmapi.dll', + 'uxtheme.dll', + 'ole32.dll', + 'oleaut32.dll', + ], + # Set /SUBSYSTEM:WINDOWS for chrome.exe itself. + 'SubSystem': '2', + }, + 'VCManifestTool': { + 'AdditionalManifestFiles': '$(ProjectDir)\\app\\chrome.exe.manifest', }, }, + 'actions': [ + { + 'action_name': 'first_run', + 'inputs': [ + 'app/FirstRun', + ], + 'outputs': [ + '<(PRODUCT_DIR)/First Run', + ], + 'action': ['cp', '-f', '<@(_inputs)', '<@(_outputs)'], + 'message': 'Copy first run complete sentinel file', + }, + ], + }, { # 'OS!="win" + 'sources!': [ + 'app/client_util.cc', + ], }], ], }, @@ -516,22 +493,31 @@ 'target_name': 'chrome_nacl_win64', 'type': 'executable', 'product_name': 'nacl64', - 'variables': { - 'chrome_exe_target': 1, - }, + 'sources': [ + 'app/breakpad_win.cc', + 'app/hard_error_handler_win.cc', + 'nacl/nacl_exe_win_64.cc', + '../content/app/startup_helper_win.cc', + '../content/common/content_switches.cc', + '../content/common/debug_flags.cc', # Needed for sandbox_policy.cc + '../content/common/hi_res_timer_manager_win.cc', + '../content/common/sandbox_policy.cc', + '../content/common/sandbox_init_wrapper_win.cc', + '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_exe_version.rc', + ], 'dependencies': [ - # On Windows make sure we've built Win64 version of chrome_dll, - # which contains all of the library code with Chromium - # functionality. + 'app/policy/cloud_policy_codegen.gyp:policy_win64', 'chrome_version_resources', - 'chrome_dll_nacl_win64', 'common_constants_win64', 'installer_util_nacl_win64', - 'app/policy/cloud_policy_codegen.gyp:policy_win64', + 'nacl_win64', '../breakpad/breakpad.gyp:breakpad_handler_win64', '../breakpad/breakpad.gyp:breakpad_sender_win64', + '../base/base.gyp:base_i18n_nacl_win64', '../base/base.gyp:base_nacl_win64', '../base/base.gyp:base_static_win64', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', + '../ipc/ipc.gyp:ipc_win64', '../sandbox/sandbox.gyp:sandbox_win64', ], 'defines': [ @@ -540,13 +526,11 @@ 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/chrome', ], - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_exe_version.rc', - ], 'msvs_settings': { 'VCLinkerTool': { 'ImportLibrary': '$(OutDir)\\lib\\nacl64_exe.lib', 'ProgramDatabaseFile': '$(OutDir)\\nacl64_exe.pdb', + 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS }, }, 'configurations': { diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index 0184555..760a266 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -17,6 +17,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" +#include "chrome/common/render_messages.h" #include "content/common/pepper_plugin_registry.h" #include "remoting/client/plugin/pepper_entrypoints.h" #include "ui/base/l10n/l10n_util.h" @@ -29,10 +30,6 @@ #include "sandbox/src/sandbox.h" #endif -#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. -#include "chrome/common/render_messages.h" -#endif - namespace { const char kPDFPluginName[] = "Chrome PDF Viewer"; @@ -61,7 +58,6 @@ const char kRemotingViewerPluginOldMimeType[] = "pepper-application/x-chromoting"; #endif -#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. // Appends the known built-in plugins to the given vector. Some built-in // plugins are "internal" which means they are compiled into the Chrome binary, // and some are extra shared libraries distributed with the browser (these are @@ -190,8 +186,6 @@ void AddOutOfProcessFlash(std::vector<PepperPluginInfo>* plugins) { plugins->push_back(plugin); } -#endif // !defined(NACL_WIN64) - #if defined(OS_WIN) // Launches the privileged flash broker, used when flash is sandboxed. // The broker is the same flash dll, except that it uses a different @@ -276,14 +270,11 @@ void ChromeContentClient::SetGpuInfo(const GPUInfo& gpu_info) { void ChromeContentClient::AddPepperPlugins( std::vector<PepperPluginInfo>* plugins) { -#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. ComputeBuiltInPlugins(plugins); AddOutOfProcessFlash(plugins); -#endif } bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { -#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. // Any Chrome-specific messages that must be allowed to be sent from swapped // out renderers. switch (msg->type()) { @@ -292,13 +283,11 @@ bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { default: break; } -#endif return false; } bool ChromeContentClient::CanHandleWhileSwappedOut( const IPC::Message& msg) { -#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. // Any Chrome-specific messages (apart from those listed in // CanSendWhileSwappedOut) that must be handled by the browser when sent from // swapped out renderers. @@ -308,7 +297,6 @@ bool ChromeContentClient::CanHandleWhileSwappedOut( default: break; } -#endif return false; } @@ -321,19 +309,11 @@ std::string ChromeContentClient::GetUserAgent(bool mimic_windows) const { } string16 ChromeContentClient::GetLocalizedString(int message_id) const { -#if defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. - return string16(); -#else return l10n_util::GetStringUTF16(message_id); -#endif } base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { -#if defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds. - return base::StringPiece(); -#else return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); -#endif } #if defined(OS_WIN) diff --git a/chrome/common/chrome_content_plugin_client.cc b/chrome/common/chrome_content_plugin_client.cc index 1d38ee4..5430cbd 100644 --- a/chrome/common/chrome_content_plugin_client.cc +++ b/chrome/common/chrome_content_plugin_client.cc @@ -30,9 +30,7 @@ void ChromeContentPluginClient::PluginProcessStarted( base::mac::SetProcessName(process_name); #endif -#if !defined(NACL_WIN64) // We don't link this in the NaCl 64 bit binary. chrome::RegisterInternalDefaultPlugin(); -#endif } } // namespace chrome diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc index 9f506a9..4e5d1f0 100644 --- a/chrome/common/chrome_version_info.cc +++ b/chrome/common/chrome_version_info.cc @@ -92,7 +92,6 @@ bool VersionInfo::IsOfficialBuild() const { std::string VersionInfo::CreateVersionString() const { std::string current_version; -#if !defined(NACL_WIN64) if (is_valid()) { current_version += Version(); #if !defined(GOOGLE_CHROME_BUILD) @@ -108,7 +107,6 @@ std::string VersionInfo::CreateVersionString() const { if (!modifier.empty()) current_version += " " + modifier; } -#endif // !defined(NACL_WIN64) return current_version; } diff --git a/chrome/common/googleurl_dummy.cc b/chrome/common/googleurl_dummy.cc deleted file mode 100644 index f55c263..0000000 --- a/chrome/common/googleurl_dummy.cc +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -namespace url_util { - -// A dummy version of the url_util function called by url_constants.cc for all -// process types. For some processes, we don't want to link against googleurl. -// rather than having complicated versions of that library (32 and 64 bit ones -// on Windows) we just instead link this file in cases where googleurl isn't -// otherwise necessary. -void AddStandardScheme(const char* new_scheme) { -} - -void LockStandardSchemes() { -} - -} // namespace url_util diff --git a/chrome/common/nacl_cmd_line.cc b/chrome/common/nacl_cmd_line.cc index 4c2f19f..0da6f96 100644 --- a/chrome/common/nacl_cmd_line.cc +++ b/chrome/common/nacl_cmd_line.cc @@ -5,14 +5,11 @@ #include "base/command_line.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/logging_chrome.h" namespace nacl { void CopyNaClCommandLineArguments(CommandLine* cmd_line) { const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); - if (logging::DialogsAreSuppressed()) - cmd_line->AppendSwitch(switches::kNoErrorDialogs); // Propagate the following switches to the NaCl loader command line (along // with any associated values) if present in the browser command line. @@ -31,6 +28,7 @@ void CopyNaClCommandLineArguments(CommandLine* cmd_line) { switches::kEnableNaClDebug, switches::kNaClDebugPorts, switches::kNaClDebugIP, + switches::kNoErrorDialogs, }; cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, arraysize(kSwitchNames)); diff --git a/chrome/installer/mini_installer.gyp b/chrome/installer/mini_installer.gyp index 2854633..6c41bd3 100644 --- a/chrome/installer/mini_installer.gyp +++ b/chrome/installer/mini_installer.gyp @@ -192,7 +192,6 @@ '<(PRODUCT_DIR)/chrome.exe', '<(PRODUCT_DIR)/chrome.dll', '<(PRODUCT_DIR)/nacl64.exe', - '<(PRODUCT_DIR)/nacl64.dll', '<(PRODUCT_DIR)/ppGoogleNaClPluginChrome.dll', '<(PRODUCT_DIR)/nacl_irt_x86_32.nexe', '<(PRODUCT_DIR)/nacl_irt_x86_64.nexe', diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release index aab00a3..540b454 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -33,7 +33,6 @@ wow_helper.exe: %(ChromeDir)s\ Dictionaries\en-US.bdic: %(ChromeDir)s\Dictionaries
chrome.dll: %(VersionDir)s\
nacl64.exe: %(VersionDir)s\
-nacl64.dll: %(VersionDir)s\
ppGoogleNaClPluginChrome.dll: %(VersionDir)s\
nacl_irt_x86_32.nexe: %(VersionDir)s\
nacl_irt_x86_64.nexe: %(VersionDir)s\
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 199eece..c470faf 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -164,7 +164,6 @@ const wchar_t kChromeFrameHelperExe[] = L"chrome_frame_helper.exe"; const wchar_t kChromeFrameHelperWndClass[] = L"ChromeFrameHelperWindowClass"; const wchar_t kChromeFrameReadyModeField[] = L"ChromeFrameReadyMode"; const wchar_t kChromeLauncherExe[] = L"chrome_launcher.exe"; -const wchar_t kChromeNaCl64Dll[] = L"nacl64.dll"; const wchar_t kChromeNewExe[] = L"new_chrome.exe"; const wchar_t kChromeOldExe[] = L"old_chrome.exe"; const wchar_t kCmdQuickEnableCf[] = L"quick-enable-cf"; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index d851359..95d79df 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -168,7 +168,6 @@ extern const wchar_t kChromeFrameHelperExe[]; extern const wchar_t kChromeFrameHelperWndClass[]; extern const wchar_t kChromeFrameReadyModeField[]; extern const wchar_t kChromeLauncherExe[]; -extern const wchar_t kChromeNaCl64Dll[]; extern const wchar_t kChromeOldExe[]; extern const wchar_t kChromeNewExe[]; extern const wchar_t kCmdQuickEnableCf[]; diff --git a/chrome/nacl.gypi b/chrome/nacl.gypi index d8591b0..86a5467 100644 --- a/chrome/nacl.gypi +++ b/chrome/nacl.gypi @@ -66,9 +66,6 @@ 'python build_nacl_irt.py --inputs', }, 'dependencies': [ - # TODO(gregoryd): chrome_resources and chrome_strings could be - # shared with the 64-bit target, but it does not work due to a gyp - #issue 'chrome_resources', 'chrome_strings', 'common', @@ -149,18 +146,17 @@ 'nacl_target': 1, }, 'dependencies': [ - # TODO(gregoryd): chrome_resources and chrome_strings could be - # shared with the 32-bit target, but it does not work due to a gyp - #issue - 'chrome_resources', - 'chrome_strings', - 'common_nacl_win64', '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel64', '../native_client/src/trusted/platform_qualify/platform_qualify.gyp:platform_qual_lib64', ], 'sources': [ - 'nacl/broker_thread.cc', - 'nacl/broker_thread.h', + 'common/nacl_cmd_line.cc', + 'common/nacl_messages.cc', + 'nacl/nacl_broker_listener.cc', + 'nacl/nacl_broker_listener.h', + ], + 'include_dirs': [ + '..', ], 'defines': [ '<@(nacl_win64_defines)', diff --git a/chrome/nacl/broker_thread.cc b/chrome/nacl/nacl_broker_listener.cc index dad7f3a..cf2b8a0 100644 --- a/chrome/nacl/broker_thread.cc +++ b/chrome/nacl/nacl_broker_listener.cc @@ -2,35 +2,45 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/nacl/broker_thread.h" +#include "chrome/nacl/nacl_broker_listener.h" #include "base/base_switches.h" #include "base/command_line.h" +#include "base/message_loop.h" #include "base/path_service.h" #include "base/process_util.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/nacl_cmd_line.h" #include "chrome/common/nacl_messages.h" -#include "content/common/child_process.h" +#include "content/common/content_switches.h" #include "content/common/sandbox_policy.h" #include "ipc/ipc_switches.h" -NaClBrokerThread::NaClBrokerThread() - : browser_handle_(0), - broker_services_(NULL) { +NaClBrokerListener::NaClBrokerListener() + : browser_handle_(base::kNullProcessHandle) { } -NaClBrokerThread::~NaClBrokerThread() { +NaClBrokerListener::~NaClBrokerListener() { base::CloseProcessHandle(browser_handle_); } -NaClBrokerThread* NaClBrokerThread::current() { - return static_cast<NaClBrokerThread*>(ChildThread::current()); +void NaClBrokerListener::Listen() { + std::string channel_name = + CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kProcessChannelID); + channel_.reset(new IPC::Channel( + channel_name, IPC::Channel::MODE_CLIENT, this)); + CHECK(channel_->Connect()); + MessageLoop::current()->Run(); } -bool NaClBrokerThread::OnControlMessageReceived(const IPC::Message& msg) { +void NaClBrokerListener::OnChannelConnected(int32 peer_pid) { + bool res = base::OpenProcessHandle(peer_pid, &browser_handle_); + CHECK(res); +} + +bool NaClBrokerListener::OnMessageReceived(const IPC::Message& msg) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP(NaClBrokerThread, msg) + IPC_BEGIN_MESSAGE_MAP(NaClBrokerListener, msg) IPC_MESSAGE_HANDLER(NaClProcessMsg_LaunchLoaderThroughBroker, OnLaunchLoaderThroughBroker) IPC_MESSAGE_HANDLER(NaClProcessMsg_StopBroker, OnStopBroker) @@ -39,7 +49,7 @@ bool NaClBrokerThread::OnControlMessageReceived(const IPC::Message& msg) { return handled; } -void NaClBrokerThread::OnLaunchLoaderThroughBroker( +void NaClBrokerListener::OnLaunchLoaderThroughBroker( const std::wstring& loader_channel_id) { base::ProcessHandle loader_process = 0; base::ProcessHandle loader_handle_in_browser = 0; @@ -62,21 +72,14 @@ void NaClBrokerThread::OnLaunchLoaderThroughBroker( loader_process = sandbox::StartProcessWithAccess(cmd_line, FilePath()); if (loader_process) { DuplicateHandle(::GetCurrentProcess(), loader_process, - browser_handle_, &loader_handle_in_browser, - PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION , FALSE, 0); + browser_handle_, &loader_handle_in_browser, + PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION , FALSE, 0); } } - Send(new NaClProcessMsg_LoaderLaunched(loader_channel_id, - loader_handle_in_browser)); + channel_->Send(new NaClProcessMsg_LoaderLaunched(loader_channel_id, + loader_handle_in_browser)); } -void NaClBrokerThread::OnStopBroker() { - ChildProcess::current()->ReleaseProcess(); +void NaClBrokerListener::OnStopBroker() { + MessageLoop::current()->Quit(); } - -void NaClBrokerThread::OnChannelConnected(int32 peer_pid) { - bool res = base::OpenProcessHandle(peer_pid, &browser_handle_); - DCHECK(res); - ChildProcess::current()->AddRefProcess(); -} - diff --git a/chrome/nacl/broker_thread.h b/chrome/nacl/nacl_broker_listener.h index b0a05b9..1581c6d 100644 --- a/chrome/nacl/broker_thread.h +++ b/chrome/nacl/nacl_broker_listener.h @@ -2,40 +2,37 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_NACL_BROKER_THREAD_H_ -#define CHROME_NACL_BROKER_THREAD_H_ +#ifndef CHROME_NACL_NACL_BROKER_LISTENER_H_ +#define CHROME_NACL_NACL_BROKER_LISTENER_H_ #pragma once +#include "base/memory/scoped_ptr.h" #include "base/process.h" #include "chrome/common/nacl_types.h" -#include "content/common/child_thread.h" - -#if defined(OS_WIN) -#include "sandbox/src/sandbox.h" -#endif +#include "ipc/ipc_channel.h" // The BrokerThread class represents the thread that handles the messages from // the browser process and starts NaCl loader processes. -class NaClBrokerThread : public ChildThread { +class NaClBrokerListener : public IPC::Channel::Listener { public: - NaClBrokerThread(); - ~NaClBrokerThread(); - // Returns the one NaCl thread. - static NaClBrokerThread* current(); + NaClBrokerListener(); + ~NaClBrokerListener(); + + void Listen(); // IPC::Channel::Listener implementation. virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; private: - virtual bool OnControlMessageReceived(const IPC::Message& msg); void OnLaunchLoaderThroughBroker(const std::wstring& loader_channel_id); void OnShareBrowserHandle(int browser_handle); void OnStopBroker(); base::ProcessHandle browser_handle_; - sandbox::BrokerServices* broker_services_; + scoped_ptr<IPC::Channel> channel_; - DISALLOW_COPY_AND_ASSIGN(NaClBrokerThread); + DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener); }; -#endif // CHROME_NACL_BROKER_THREAD_H_ +#endif // CHROME_NACL_NACL_BROKER_LISTENER_H_ diff --git a/chrome/nacl/nacl_exe_win_64.cc b/chrome/nacl/nacl_exe_win_64.cc new file mode 100644 index 0000000..834fc37 --- /dev/null +++ b/chrome/nacl/nacl_exe_win_64.cc @@ -0,0 +1,105 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/at_exit.h" +#include "base/command_line.h" +#include "base/logging.h" +#include "base/message_loop.h" +#include "base/process_util.h" +#include "base/string_util.h" +#include "base/system_monitor/system_monitor.h" +#include "chrome/app/breakpad_win.h" +#include "chrome/common/chrome_result_codes.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/common/logging_chrome.h" +#include "chrome/nacl/nacl_broker_listener.h" +#include "chrome/nacl/nacl_listener.h" +#include "chrome/nacl/nacl_main_platform_delegate.h" +#include "content/app/startup_helper_win.h" +#include "content/common/hi_res_timer_manager.h" +#include "content/common/main_function_params.h" +#include "content/common/sandbox_init_wrapper.h" +#include "content/common/sandbox_policy.h" +#include "sandbox/src/sandbox.h" +#include "sandbox/src/sandbox_types.h" + +extern int NaClMain(const MainFunctionParams&); + +// main() routine for the NaCl broker process. +// This is necessary for supporting NaCl in Chrome on Win64. +int NaClBrokerMain(const MainFunctionParams& parameters) { + const CommandLine& parsed_command_line = parameters.command_line_; + + MessageLoopForIO main_message_loop; + base::PlatformThread::SetName("CrNaClBrokerMain"); + + base::SystemMonitor system_monitor; + HighResolutionTimerManager hi_res_timer_manager; + + // NOTE: this code is duplicated from browser_main.cc + // IMPORTANT: This piece of code needs to run as early as possible in the + // process because it will initialize the sandbox broker, which requires the + // process to swap its window station. During this time all the UI will be + // broken. This has to run before threads and windows are created. + sandbox::BrokerServices* broker_services = + parameters.sandbox_info_.BrokerServices(); + if (broker_services) { + sandbox::InitBrokerServices(broker_services); + if (!parsed_command_line.HasSwitch(switches::kNoSandbox)) { + bool use_winsta = !parsed_command_line.HasSwitch( + switches::kDisableAltWinstation); + // Precreate the desktop and window station used by the renderers. + sandbox::TargetPolicy* policy = broker_services->CreatePolicy(); + sandbox::ResultCode result = policy->CreateAlternateDesktop(use_winsta); + CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result); + policy->Release(); + } + } + + NaClBrokerListener listener; + listener.Listen(); + + return 0; +} + +int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { + sandbox::SandboxInterfaceInfo sandbox_info = {0}; + content::InitializeSandboxInfo(&sandbox_info); + + base::AtExitManager exit_manager; + CommandLine::Init(0, NULL); + + wchar_t path[MAX_PATH]; + ::GetModuleFileNameW(NULL, path, MAX_PATH); + InitCrashReporterWithDllPath(std::wstring(path)); + + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + std::string process_type = + command_line.GetSwitchValueASCII(switches::kProcessType); + + // Copy what ContentMain() does. + base::EnableTerminationOnHeapCorruption(); + base::EnableTerminationOnOutOfMemory(); + content::RegisterInvalidParamHandler(); + content::SetupCRT(command_line); + + // Initialize the sandbox for this process. + SandboxInitWrapper sandbox_wrapper; + sandbox_wrapper.SetServices(&sandbox_info); + bool sandbox_initialized_ok = + sandbox_wrapper.InitializeSandbox(command_line, process_type); + // Die if the sandbox can't be enabled. + CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " + << process_type; + MainFunctionParams main_params(command_line, sandbox_wrapper, NULL); + + if (process_type == switches::kNaClLoaderProcess) + return NaClMain(main_params); + + if (process_type == switches::kNaClBrokerProcess) + return NaClBrokerMain(main_params); + + CHECK(false) << "Unknown NaCl 64 process."; + return -1; +} diff --git a/chrome/nacl/nacl_helper_linux.cc b/chrome/nacl/nacl_helper_linux.cc index 7ffeadb..3f8646f 100644 --- a/chrome/nacl/nacl_helper_linux.cc +++ b/chrome/nacl/nacl_helper_linux.cc @@ -47,8 +47,8 @@ void BecomeNaClLoader(const std::vector<int>& child_fds) { } MessageLoopForIO main_message_loop; - NaClListener *listener = new NaClListener(); - listener->Listen(); + NaClListener listener; + listener.Listen(); _exit(0); } diff --git a/chrome/nacl/nacl_listener.h b/chrome/nacl/nacl_listener.h index 336cb59..f0d275e 100644 --- a/chrome/nacl/nacl_listener.h +++ b/chrome/nacl/nacl_listener.h @@ -15,17 +15,19 @@ // request to start a NaCl module. class NaClListener : public IPC::Channel::Listener { public: - explicit NaClListener(); + NaClListener(); virtual ~NaClListener(); // Listen for a request to launch a NaCl module. void Listen(); void set_debug_enabled(bool value) {debug_enabled_ = value;} + private: - bool debug_enabled_; void OnStartSelLdr(std::vector<nacl::FileDescriptor> handles, bool have_irt_file); virtual bool OnMessageReceived(const IPC::Message& msg); + bool debug_enabled_; + DISALLOW_COPY_AND_ASSIGN(NaClListener); }; diff --git a/chrome/nacl/nacl_main.cc b/chrome/nacl/nacl_main.cc index 92f26ee..4b3caae 100644 --- a/chrome/nacl/nacl_main.cc +++ b/chrome/nacl/nacl_main.cc @@ -4,89 +4,28 @@ #include "build/build_config.h" -#if defined(OS_WIN) -#include <windows.h> -#endif - #include "base/command_line.h" #include "base/message_loop.h" -#include "base/string_util.h" #include "base/system_monitor/system_monitor.h" -#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_result_codes.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" #include "chrome/nacl/nacl_listener.h" #include "chrome/nacl/nacl_main_platform_delegate.h" #include "content/common/child_process.h" -#include "content/common/child_process_info.h" #include "content/common/hi_res_timer_manager.h" #include "content/common/main_function_params.h" -#include "content/common/sandbox_policy.h" -#include "ipc/ipc_switches.h" - -#if defined(OS_WIN) -#include "chrome/nacl/broker_thread.h" -#include "sandbox/src/sandbox.h" -#endif - -#ifdef _WIN64 - -// main() routine for the NaCl broker process. -// This is necessary for supporting NaCl in Chrome on Win64. -int NaClBrokerMain(const MainFunctionParams& parameters) { - // The main thread of the broker. - MessageLoopForIO main_message_loop; - base::PlatformThread::SetName("CrNaClBrokerMain"); - - base::SystemMonitor system_monitor; - HighResolutionTimerManager hi_res_timer_manager; - - const CommandLine& parsed_command_line = parameters.command_line_; - - DVLOG(1) << "Started NaCL broker with " - << parsed_command_line.GetCommandLineString(); - - // NOTE: this code is duplicated from browser_main.cc - // IMPORTANT: This piece of code needs to run as early as possible in the - // process because it will initialize the sandbox broker, which requires the - // process to swap its window station. During this time all the UI will be - // broken. This has to run before threads and windows are created. - sandbox::BrokerServices* broker_services = - parameters.sandbox_info_.BrokerServices(); - if (broker_services) { - sandbox::InitBrokerServices(broker_services); - if (!parsed_command_line.HasSwitch(switches::kNoSandbox)) { - bool use_winsta = !parsed_command_line.HasSwitch( - switches::kDisableAltWinstation); - // Precreate the desktop and window station used by the renderers. - sandbox::TargetPolicy* policy = broker_services->CreatePolicy(); - sandbox::ResultCode result = policy->CreateAlternateDesktop(use_winsta); - CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result); - policy->Release(); - } - } - - { - ChildProcess broker_process; - broker_process.set_main_thread(new NaClBrokerThread()); - MessageLoop::current()->Run(); - } - - return 0; -} -#else -int NaClBrokerMain(const MainFunctionParams& parameters) { - return chrome::RESULT_CODE_BAD_PROCESS_TYPE; -} -#endif // _WIN64 // This function provides some ways to test crash and assertion handling // behavior of the renderer. static void HandleNaClTestParameters(const CommandLine& command_line) { +// The message box doesn't work in the 64 bit binaries anyways, so no need to +// link to it since the 64 bit binary doesn't link with chrome or content. +#if !defined(NACL_WIN64) if (command_line.HasSwitch(switches::kNaClStartupDialog)) { ChildProcess::WaitForDebugger("NativeClient"); } +#endif } // main() routine for the NaCl loader process. diff --git a/chrome/nacl/nacl_main_platform_delegate_win.cc b/chrome/nacl/nacl_main_platform_delegate_win.cc index aba8481..97ba3af 100644 --- a/chrome/nacl/nacl_main_platform_delegate_win.cc +++ b/chrome/nacl/nacl_main_platform_delegate_win.cc @@ -8,7 +8,6 @@ #include "base/file_path.h" #include "base/logging.h" #include "base/native_library.h" -#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" #include "sandbox/src/sandbox.h" diff --git a/chrome/tools/build/win/FILES b/chrome/tools/build/win/FILES index 338415b..d133c9e 100644 --- a/chrome/tools/build/win/FILES +++ b/chrome/tools/build/win/FILES @@ -4,7 +4,6 @@ avutil-51.dll chrome.exe nacl64.exe chrome.dll -nacl64.dll crash_service.exe crash_service64.exe First Run diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg index 096d2c6..ce99eae 100644 --- a/chrome/tools/build/win/FILES.cfg +++ b/chrome/tools/build/win/FILES.cfg @@ -46,11 +46,6 @@ FILES = [ 'buildtype': ['dev', 'official'], }, { - 'filename': 'nacl64.dll', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { 'filename': 'crash_service.exe', 'arch': ['32bit', '64bit'], 'buildtype': ['dev', 'official'], diff --git a/chrome/tools/build/win/SYMBOLS b/chrome/tools/build/win/SYMBOLS index f599797..2f53567 100644 --- a/chrome/tools/build/win/SYMBOLS +++ b/chrome/tools/build/win/SYMBOLS @@ -3,7 +3,6 @@ chrome_exe.pdb libEGL.pdb libGLESv2.pdb mini_installer.pdb -nacl64_dll.pdb nacl64_exe.pdb ppGoogleNaClPluginChrome.pdb setup.pdb diff --git a/content/app/content_main.cc b/content/app/content_main.cc index 78e1af5..e40dca9 100644 --- a/content/app/content_main.cc +++ b/content/app/content_main.cc @@ -5,7 +5,6 @@ #include "content/app/content_main.h" #include "base/at_exit.h" -#include "base/base_switches.h" #include "base/command_line.h" #include "base/debug/debugger.h" #include "base/i18n/icu_util.h" @@ -17,6 +16,7 @@ #include "base/stringprintf.h" #include "base/string_number_conversions.h" #include "content/app/content_main_delegate.h" +#include "content/app/startup_helper_win.h" #include "content/common/content_constants.h" #include "content/common/content_paths.h" #include "content/common/content_switches.h" @@ -31,7 +31,6 @@ #if defined(OS_WIN) #include <atlbase.h> #include <atlapp.h> -#include <new.h> #include <malloc.h> #elif defined(OS_MACOSX) #include "base/mach_ipc_mac.h" @@ -76,31 +75,6 @@ namespace { static CAppModule _Module; -#pragma optimize("", off) -// Handlers for invalid parameter and pure call. They generate a breakpoint to -// tell breakpad that it needs to dump the process. -void InvalidParameter(const wchar_t* expression, const wchar_t* function, - const wchar_t* file, unsigned int line, - uintptr_t reserved) { - __debugbreak(); - _exit(1); -} - -void PureCall() { - __debugbreak(); - _exit(1); -} -#pragma optimize("", on) - -// Register the invalid param handler and pure call handler to be able to -// notify breakpad when it happens. -void RegisterInvalidParamHandler() { - _set_invalid_parameter_handler(InvalidParameter); - _set_purecall_handler(PureCall); - // Also enable the new handler for malloc() based failures. - _set_new_mode(1); -} - #elif defined(OS_MACOSX) // Completes the Mach IPC handshake by sending this process' task port to the @@ -154,19 +128,6 @@ void SetupSignalHandlers() { #endif // OS_POSIX -void SetupCRT(const CommandLine& command_line) { -#if defined(OS_WIN) -#if defined(_CRTDBG_MAP_ALLOC) - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); -#else - if (!command_line.HasSwitch(switches::kDisableBreakpad)) { - _CrtSetReportMode(_CRT_ASSERT, 0); - } -#endif -#endif -} - void CommonSubprocessInit(const std::string& process_type) { #if defined(OS_WIN) // HACK: Let Windows know that we have started. This is needed to suppress @@ -319,7 +280,7 @@ int ContentMain(HINSTANCE instance, int argc = 0; char** argv = NULL; - RegisterInvalidParamHandler(); + content::RegisterInvalidParamHandler(); _Module.Init(NULL, static_cast<HINSTANCE>(instance)); #else int ContentMain(int argc, @@ -392,6 +353,8 @@ int ContentMain(int argc, (!delegate || delegate->ShouldSendMachPort(process_type))) { SendTaskPortToParentProcess(); } +#elif defined(OS_WIN) + content::SetupCRT(command_line); #endif #if defined(OS_POSIX) @@ -412,8 +375,6 @@ int ContentMain(int argc, } #endif - SetupCRT(command_line); - #if defined(USE_NSS) crypto::EarlySetupForNSSInit(); #endif diff --git a/content/app/sandbox_helper_win.cc b/content/app/sandbox_helper_win.cc deleted file mode 100644 index a817e08..0000000 --- a/content/app/sandbox_helper_win.cc +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/app/content_main.h" - -#include "base/win/windows_version.h" -#include "sandbox/src/dep.h" -#include "sandbox/src/sandbox_factory.h" - -namespace content { - -void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info) { - info->broker_services = sandbox::SandboxFactory::GetBrokerServices(); - if (!info->broker_services) - info->target_services = sandbox::SandboxFactory::GetTargetServices(); - - if (base::win::GetVersion() < base::win::VERSION_VISTA) { - // Enforces strong DEP support. Vista uses the NXCOMPAT flag in the exe. - sandbox::SetCurrentProcessDEP(sandbox::DEP_ENABLED); - } -} - -} // namespace content diff --git a/content/app/sandbox_helper_win.h b/content/app/sandbox_helper_win.h deleted file mode 100644 index 4fc736d..0000000 --- a/content/app/sandbox_helper_win.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_APP_SANDBOX_HELPER_WIN_H_ -#define CONTENT_APP_SANDBOX_HELPER_WIN_H_ -#pragma once - -namespace sandbox { -struct SandboxInterfaceInfo; -} - -namespace content { - -// Initializes the sandbox code and turns on DEP. -void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* sandbox_info); - -} // namespace content - -#endif // CONTENT_APP_SANDBOX_HELPER_WIN_H_ diff --git a/content/app/startup_helper_win.cc b/content/app/startup_helper_win.cc new file mode 100644 index 0000000..8e1a32b --- /dev/null +++ b/content/app/startup_helper_win.cc @@ -0,0 +1,69 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/app/startup_helper_win.h" + +#include <crtdbg.h> +#include <new.h> + +#include "base/base_switches.h" +#include "base/command_line.h" +#include "base/win/windows_version.h" +#include "sandbox/src/dep.h" +#include "sandbox/src/sandbox_factory.h" + +namespace { + +#pragma optimize("", off) +// Handlers for invalid parameter and pure call. They generate a breakpoint to +// tell breakpad that it needs to dump the process. +void InvalidParameter(const wchar_t* expression, const wchar_t* function, + const wchar_t* file, unsigned int line, + uintptr_t reserved) { + __debugbreak(); + _exit(1); +} + +void PureCall() { + __debugbreak(); + _exit(1); +} +#pragma optimize("", on) + +} // namespace + +namespace content { + +void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info) { + info->broker_services = sandbox::SandboxFactory::GetBrokerServices(); + if (!info->broker_services) + info->target_services = sandbox::SandboxFactory::GetTargetServices(); + + if (base::win::GetVersion() < base::win::VERSION_VISTA) { + // Enforces strong DEP support. Vista uses the NXCOMPAT flag in the exe. + sandbox::SetCurrentProcessDEP(sandbox::DEP_ENABLED); + } +} + +// Register the invalid param handler and pure call handler to be able to +// notify breakpad when it happens. +void RegisterInvalidParamHandler() { + _set_invalid_parameter_handler(InvalidParameter); + _set_purecall_handler(PureCall); + // Also enable the new handler for malloc() based failures. + _set_new_mode(1); +} + +void SetupCRT(const CommandLine& command_line) { +#if defined(_CRTDBG_MAP_ALLOC) + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); +#else + if (!command_line.HasSwitch(switches::kDisableBreakpad)) { + _CrtSetReportMode(_CRT_ASSERT, 0); + } +#endif +} + +} // namespace content diff --git a/content/app/startup_helper_win.h b/content/app/startup_helper_win.h new file mode 100644 index 0000000..5898e36 --- /dev/null +++ b/content/app/startup_helper_win.h @@ -0,0 +1,31 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_APP_STARTUP_HELPER_WIN_H_ +#define CONTENT_APP_STARTUP_HELPER_WIN_H_ +#pragma once + +class CommandLine; + +namespace sandbox { +struct SandboxInterfaceInfo; +} + +// This file contains functions that any embedder that's not using ContentMain +// will want to call at startup. +namespace content { + +// Initializes the sandbox code and turns on DEP. +void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* sandbox_info); + +// Register the invalid param handler and pure call handler to be able to +// notify breakpad when it happens. +void RegisterInvalidParamHandler(); + +// Sets up the CRT's debugging macros to output to stdout. +void SetupCRT(const CommandLine& command_line); + +} // namespace content + +#endif // CONTENT_APP_STARTUP_HELPER_WIN_H_ diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc index 9aea6a1e..95d0080 100644 --- a/content/common/child_thread.cc +++ b/content/common/child_thread.cc @@ -59,12 +59,7 @@ void ChildThread::Init() { sync_message_filter_ = new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); channel_->AddFilter(sync_message_filter_.get()); - -#if !defined(NACL_WIN64) - // This brings in a depenency on gpu, which isn't linked in with NaCl's win64 - // build. channel_->AddFilter(new ChildTraceMessageFilter()); -#endif // When running in unit tests, there is already a NotificationService object. // Since only one can exist at a time per thread, check first. diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index c34cfcb..881eb7b 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -6,9 +6,6 @@ #include "content/common/child_process_messages.h" -// NaCl's 64 bit Windows build only links with a bare-minimum number of -// libraries. -#if !defined(NACL_WIN64) #include "content/common/appcache_messages.h" #include "content/common/clipboard_messages.h" #include "content/common/database_messages.h" @@ -38,4 +35,3 @@ #include "content/common/view_messages.h" #include "content/common/webblob_messages.h" #include "content/common/worker_messages.h" -#endif diff --git a/content/common/file_system/file_system_dispatcher_dummy.cc b/content/common/file_system/file_system_dispatcher_dummy.cc deleted file mode 100644 index c7f567f..0000000 --- a/content/common/file_system/file_system_dispatcher_dummy.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/file_system/file_system_dispatcher.h" - -#include "base/compiler_specific.h" - -// FileSystemDispatcher -------------------------------------------------------- - -FileSystemDispatcher::FileSystemDispatcher() { -} - -FileSystemDispatcher::~FileSystemDispatcher() { -} - -// FileSystemDispatcher implementation ----------------------------------------- - -bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& message) { - return false; -} diff --git a/content/common/quota_dispatcher_dummy.cc b/content/common/quota_dispatcher_dummy.cc deleted file mode 100644 index 7eec28b..0000000 --- a/content/common/quota_dispatcher_dummy.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/quota_dispatcher.h" - -#include "base/compiler_specific.h" - -// QuotaDispatcher ------------------------------------------------------------- - -QuotaDispatcher::QuotaDispatcher() { -} - -QuotaDispatcher::~QuotaDispatcher() { -} - -// QuotaDispatcher implementation ---------------------------------------------- - -bool QuotaDispatcher::OnMessageReceived(const IPC::Message& message) { - return false; -} diff --git a/content/common/resource_dispatcher_dummy.cc b/content/common/resource_dispatcher_dummy.cc deleted file mode 100644 index 5998027..0000000 --- a/content/common/resource_dispatcher_dummy.cc +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// See http://dev.chromium.org/developers/design-documents/multi-process-resource-loading - -#include "content/common/resource_dispatcher.h" - -#include "base/compiler_specific.h" - -// ResourceDispatcher --------------------------------------------------------- - -ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) - : message_sender_(sender), - ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { -} - -ResourceDispatcher::~ResourceDispatcher() { -} - -// ResourceDispatcher implementation ------------------------------------------ - -bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) { - return false; -} - -webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge( - const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { - // This function is used only by plugin and renderer code, so it should - // never be called in a 64-bit Windows process. - NOTREACHED(); - return NULL; -} diff --git a/content/common/sandbox_policy.cc b/content/common/sandbox_policy.cc index 1b59cf0..ad48a2a 100644 --- a/content/common/sandbox_policy.cc +++ b/content/common/sandbox_policy.cc @@ -294,6 +294,7 @@ bool AddGenericPolicy(sandbox::TargetPolicy* policy) { // TODO(cpu): Lock down the sandbox more if possible. // TODO(apatrick): Use D3D9Ex to render windowless. bool AddPolicyForGPU(CommandLine* cmd_line, sandbox::TargetPolicy* policy) { +#if !defined(NACL_WIN64) // We don't need this code on win nacl64. if (base::win::GetVersion() > base::win::VERSION_XP) { policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, sandbox::USER_LIMITED); @@ -322,6 +323,7 @@ bool AddPolicyForGPU(CommandLine* cmd_line, sandbox::TargetPolicy* policy) { } AddGenericDllEvictionPolicy(policy); +#endif return true; } @@ -459,11 +461,13 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line, PROCESS_INFORMATION target = {0}; sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); +#if !defined(NACL_WIN64) // We don't need this code on win nacl64. if (type == ChildProcessInfo::PLUGIN_PROCESS && !browser_command_line.HasSwitch(switches::kNoSandbox) && content::GetContentClient()->SandboxPlugin(cmd_line, policy)) { in_sandbox = true; } +#endif if (!in_sandbox) { policy->Release(); diff --git a/content/common/socket_stream_dispatcher_dummy.cc b/content/common/socket_stream_dispatcher_dummy.cc deleted file mode 100644 index eef622a..0000000 --- a/content/common/socket_stream_dispatcher_dummy.cc +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/socket_stream_dispatcher.h" - -#include "base/compiler_specific.h" - -// SocketStreamDispatcher ------------------------------------------------------ - -SocketStreamDispatcher::SocketStreamDispatcher() { -} - -// SocketStreamDispatcher implementation --------------------------------------- - -bool SocketStreamDispatcher::OnMessageReceived(const IPC::Message& message) { - return false; -} diff --git a/content/content_app.gypi b/content/content_app.gypi index af7ea6b..9e199a5 100644 --- a/content/content_app.gypi +++ b/content/content_app.gypi @@ -22,8 +22,8 @@ 'app/content_main.cc', 'app/content_main.h', 'app/content_main_delegate.h', - 'app/sandbox_helper_win.cc', - 'app/sandbox_helper_win.h', + 'app/startup_helper_win.cc', + 'app/startup_helper_win.h', ], 'conditions': [ ['OS=="win"', { diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 45edb38..8805894 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -278,9 +278,7 @@ class UI_EXPORT ResourceBundle { // Handles for data sources. DataHandle resources_data_; DataHandle large_icon_resources_data_; -#if !defined(NACL_WIN64) scoped_ptr<DataPack> locale_resources_data_; -#endif // References to extra data packs loaded via AddDataPackToSharedInstance. std::vector<LoadedDataPack*> data_packs_; diff --git a/ui/base/resource/resource_bundle_dummy.cc b/ui/base/resource/resource_bundle_dummy.cc deleted file mode 100644 index 529e63a..0000000 --- a/ui/base/resource/resource_bundle_dummy.cc +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/base/resource/resource_bundle.h" - -#include <windows.h> - -#include "base/logging.h" -#include "base/synchronization/lock.h" - -// NOTE(gregoryd): This is a hack to avoid creating more nacl_win64-specific -// files. The font members of ResourceBundle are never initialized in our code -// so we can get away with an empty class definition. -namespace gfx { -class Font {}; -} - -namespace ui { - -ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; - -// static -std::string ResourceBundle::InitSharedInstance( - const std::string& pref_locale) { - DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; - g_shared_instance_ = new ResourceBundle(); - return std::string(); -} - -// static -void ResourceBundle::CleanupSharedInstance() { - if (g_shared_instance_) { - delete g_shared_instance_; - g_shared_instance_ = NULL; - } -} - -// static -ResourceBundle& ResourceBundle::GetSharedInstance() { - // Must call InitSharedInstance before this function. - CHECK(g_shared_instance_ != NULL); - return *g_shared_instance_; -} - -ResourceBundle::ResourceBundle() - : lock_(new base::Lock), - resources_data_(NULL) { -} - -ResourceBundle::~ResourceBundle() { -} - - -string16 ResourceBundle::GetLocalizedString(int message_id) { - return string16(); -} - -// static -void ResourceBundle::SetResourcesDataDLL(HINSTANCE handle) { -} - -} // namespace ui @@ -532,35 +532,5 @@ }, ], }], - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'ui_nacl_win64', - 'type': '<(component)', - 'dependencies': [ - '../base/base.gyp:base_nacl_win64', - ], - 'defines': [ - 'UI_IMPLEMENTATION', - '<@(nacl_win64_defines)', - ], - 'sources': [ - 'base/resource/resource_bundle_dummy.cc', - 'base/ui_base_paths.h', - 'base/ui_base_paths.cc', - 'base/ui_base_switches.h', - 'base/ui_base_switches.cc', - ], - 'include_dirs': [ - '..', - ], - 'configurations': { - 'Common_Base': { - 'msvs_target_platform': 'x64', - }, - }, - }, - ], - }], ], } diff --git a/webkit/glue/webkit_glue_dummy.cc b/webkit/glue/webkit_glue_dummy.cc deleted file mode 100644 index e05dd42..0000000 --- a/webkit/glue/webkit_glue_dummy.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/webkit_glue.h" -#include "webkit/glue/user_agent.h" - - -//------------------------------------------------------------------------------ -// webkit_glue impl: - -namespace webkit_glue { - -// Global variable used by the plugin quirk "die after unload". -bool g_forcefully_terminate_plugin_process = false; - -void SetUserAgent(const std::string& new_user_agent) { -} - -std::string BuildUserAgentHelper(bool mimic_windows, - const std::string& product) { - return std::string(); -} - -} // namespace webkit_glue |