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