OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "content/app/mojo/mojo_init.h" | 62 #include "content/app/mojo/mojo_init.h" |
63 #include "content/browser/gpu/gpu_process_host.h" | 63 #include "content/browser/gpu/gpu_process_host.h" |
64 #include "content/browser/renderer_host/render_process_host_impl.h" | 64 #include "content/browser/renderer_host/render_process_host_impl.h" |
65 #include "content/browser/utility_process_host_impl.h" | 65 #include "content/browser/utility_process_host_impl.h" |
66 #include "content/public/plugin/content_plugin_client.h" | 66 #include "content/public/plugin/content_plugin_client.h" |
67 #include "content/public/renderer/content_renderer_client.h" | 67 #include "content/public/renderer/content_renderer_client.h" |
68 #include "content/public/utility/content_utility_client.h" | 68 #include "content/public/utility/content_utility_client.h" |
69 #endif | 69 #endif |
70 | 70 |
71 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
72 #include <atlbase.h> | |
73 #include <atlapp.h> | |
74 #include <malloc.h> | 72 #include <malloc.h> |
75 #include <cstring> | 73 #include <cstring> |
76 | 74 |
77 #include "base/strings/string_number_conversions.h" | 75 #include "base/strings/string_number_conversions.h" |
| 76 #include "ui/base/win/atl_module.h" |
78 #include "ui/base/win/dpi_setup.h" | 77 #include "ui/base/win/dpi_setup.h" |
79 #include "ui/gfx/win/dpi.h" | 78 #include "ui/gfx/win/dpi.h" |
80 #elif defined(OS_MACOSX) | 79 #elif defined(OS_MACOSX) |
81 #include "base/mac/scoped_nsautorelease_pool.h" | 80 #include "base/mac/scoped_nsautorelease_pool.h" |
82 #if !defined(OS_IOS) | 81 #if !defined(OS_IOS) |
83 #include "base/power_monitor/power_monitor_device_source.h" | 82 #include "base/power_monitor/power_monitor_device_source.h" |
84 #include "content/browser/mach_broker_mac.h" | 83 #include "content/browser/mach_broker_mac.h" |
85 #include "content/common/sandbox_init_mac.h" | 84 #include "content/common/sandbox_init_mac.h" |
86 #endif // !OS_IOS | 85 #endif // !OS_IOS |
87 #endif // OS_WIN | 86 #endif // OS_WIN |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 base::LazyInstance<ContentPluginClient> | 128 base::LazyInstance<ContentPluginClient> |
130 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 129 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
131 base::LazyInstance<ContentRendererClient> | 130 base::LazyInstance<ContentRendererClient> |
132 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; | 131 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; |
133 base::LazyInstance<ContentUtilityClient> | 132 base::LazyInstance<ContentUtilityClient> |
134 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 133 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
135 #endif // !OS_IOS && !CHROME_MULTIPLE_DLL_BROWSER | 134 #endif // !OS_IOS && !CHROME_MULTIPLE_DLL_BROWSER |
136 | 135 |
137 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
138 | 137 |
139 static CAppModule _Module; | |
140 | |
141 #endif // defined(OS_WIN) | 138 #endif // defined(OS_WIN) |
142 | 139 |
143 #if defined(OS_POSIX) && !defined(OS_IOS) | 140 #if defined(OS_POSIX) && !defined(OS_IOS) |
144 | 141 |
145 // Setup signal-handling state: resanitize most signals, ignore SIGPIPE. | 142 // Setup signal-handling state: resanitize most signals, ignore SIGPIPE. |
146 void SetupSignalHandlers() { | 143 void SetupSignalHandlers() { |
147 // Sanitise our signal handling state. Signals that were ignored by our | 144 // Sanitise our signal handling state. Signals that were ignored by our |
148 // parent will also be ignored by us. We also inherit our parent's sigmask. | 145 // parent will also be ignored by us. We also inherit our parent's sigmask. |
149 sigset_t empty_signal_set; | 146 sigset_t empty_signal_set; |
150 CHECK(0 == sigemptyset(&empty_signal_set)); | 147 CHECK(0 == sigemptyset(&empty_signal_set)); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 static void ReleaseFreeMemoryThunk() { | 470 static void ReleaseFreeMemoryThunk() { |
474 MallocExtension::instance()->ReleaseFreeMemory(); | 471 MallocExtension::instance()->ReleaseFreeMemory(); |
475 } | 472 } |
476 #endif | 473 #endif |
477 | 474 |
478 virtual int Initialize(const ContentMainParams& params) OVERRIDE { | 475 virtual int Initialize(const ContentMainParams& params) OVERRIDE { |
479 ui_task_ = params.ui_task; | 476 ui_task_ = params.ui_task; |
480 | 477 |
481 #if defined(OS_WIN) | 478 #if defined(OS_WIN) |
482 RegisterInvalidParamHandler(); | 479 RegisterInvalidParamHandler(); |
483 _Module.Init(NULL, static_cast<HINSTANCE>(params.instance)); | 480 ui::win::CreateATLModuleIfNeeded(); |
484 | 481 |
485 sandbox_info_ = *params.sandbox_info; | 482 sandbox_info_ = *params.sandbox_info; |
486 #else // !OS_WIN | 483 #else // !OS_WIN |
487 | 484 |
488 #if defined(OS_ANDROID) | 485 #if defined(OS_ANDROID) |
489 // See note at the initialization of ExitManager, below; basically, | 486 // See note at the initialization of ExitManager, below; basically, |
490 // only Android builds have the ctor/dtor handlers set up to use | 487 // only Android builds have the ctor/dtor handlers set up to use |
491 // TRACE_EVENT right away. | 488 // TRACE_EVENT right away. |
492 TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); | 489 TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); |
493 #endif // OS_ANDROID | 490 #endif // OS_ANDROID |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 } | 765 } |
769 | 766 |
770 #if !defined(OS_IOS) | 767 #if !defined(OS_IOS) |
771 ShutdownMojo(); | 768 ShutdownMojo(); |
772 #endif | 769 #endif |
773 | 770 |
774 #if defined(OS_WIN) | 771 #if defined(OS_WIN) |
775 #ifdef _CRTDBG_MAP_ALLOC | 772 #ifdef _CRTDBG_MAP_ALLOC |
776 _CrtDumpMemoryLeaks(); | 773 _CrtDumpMemoryLeaks(); |
777 #endif // _CRTDBG_MAP_ALLOC | 774 #endif // _CRTDBG_MAP_ALLOC |
778 | |
779 _Module.Term(); | |
780 #endif // OS_WIN | 775 #endif // OS_WIN |
781 | 776 |
782 #if defined(OS_MACOSX) | 777 #if defined(OS_MACOSX) |
783 autorelease_pool_.reset(NULL); | 778 autorelease_pool_.reset(NULL); |
784 #endif | 779 #endif |
785 | 780 |
786 exit_manager_.reset(NULL); | 781 exit_manager_.reset(NULL); |
787 | 782 |
788 delegate_ = NULL; | 783 delegate_ = NULL; |
789 is_shutdown_ = true; | 784 is_shutdown_ = true; |
(...skipping 26 matching lines...) Expand all Loading... |
816 | 811 |
817 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 812 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
818 }; | 813 }; |
819 | 814 |
820 // static | 815 // static |
821 ContentMainRunner* ContentMainRunner::Create() { | 816 ContentMainRunner* ContentMainRunner::Create() { |
822 return new ContentMainRunnerImpl(); | 817 return new ContentMainRunnerImpl(); |
823 } | 818 } |
824 | 819 |
825 } // namespace content | 820 } // namespace content |
OLD | NEW |