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

Side by Side Diff: content/browser/browser_main_runner.cc

Issue 11000010: We don't need to do both OleInitialize() and CoInitializeEx() on the same thread. Eliminate the Sc… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/browser/browser_main_runner.h" 5 #include "content/public/browser/browser_main_runner.h"
6 6
7 #include "base/allocator/allocator_shim.h" 7 #include "base/allocator/allocator_shim.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/metrics/statistics_recorder.h" 13 #include "base/metrics/statistics_recorder.h"
14 #include "content/browser/browser_main_loop.h" 14 #include "content/browser/browser_main_loop.h"
15 #include "content/browser/notification_service_impl.h" 15 #include "content/browser/notification_service_impl.h"
16 #include "content/common/child_process.h" 16 #include "content/common/child_process.h"
17 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "content/public/common/main_function_params.h" 19 #include "content/public/common/main_function_params.h"
20 20
21 #if defined(OS_WIN) 21 #if defined(OS_WIN)
22 #include "base/win/metro.h" 22 #include "base/win/metro.h"
23 #include "base/win/scoped_com_initializer.h" 23 #include "ui/base/win/scoped_ole_initializer.h"
24 #include "ui/base/win/tsf_bridge.h" 24 #include "ui/base/win/tsf_bridge.h"
25 #endif 25 #endif
26 26
27 #if defined(OS_ANDROID) 27 #if defined(OS_ANDROID)
28 #include "content/browser/android/surface_texture_peer_browser_impl.h" 28 #include "content/browser/android/surface_texture_peer_browser_impl.h"
29 #endif 29 #endif
30 30
31 bool g_exited_main_message_loop = false; 31 bool g_exited_main_message_loop = false;
32 32
33 namespace { 33 namespace {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. 87 // to browser_shutdown::Shutdown or BrowserProcess::EndSession.
88 88
89 #if defined(OS_WIN) 89 #if defined(OS_WIN)
90 #if !defined(NO_TCMALLOC) 90 #if !defined(NO_TCMALLOC)
91 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic 91 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic
92 // allocator selection is not supported. 92 // allocator selection is not supported.
93 93
94 // Make this call before going multithreaded, or spawning any subprocesses. 94 // Make this call before going multithreaded, or spawning any subprocesses.
95 base::allocator::SetupSubprocessAllocator(); 95 base::allocator::SetupSubprocessAllocator();
96 #endif 96 #endif
97 com_initializer_.reset(new base::win::ScopedCOMInitializer); 97 ole_initializer_.reset(new ui::ScopedOleInitializer);
98 if (base::win::IsTsfAwareRequired()) 98 if (base::win::IsTsfAwareRequired())
99 ui::TsfBridge::Initialize(); 99 ui::TsfBridge::Initialize();
100 #endif // OS_WIN 100 #endif // OS_WIN
101 101
102 #if defined(OS_ANDROID) 102 #if defined(OS_ANDROID)
103 content::SurfaceTexturePeer::InitInstance( 103 content::SurfaceTexturePeer::InitInstance(
104 new content::SurfaceTexturePeerBrowserImpl( 104 new content::SurfaceTexturePeerBrowserImpl(
105 parameters.command_line.HasSwitch( 105 parameters.command_line.HasSwitch(
106 switches::kMediaPlayerInRenderProcess))); 106 switches::kMediaPlayerInRenderProcess)));
107 #endif 107 #endif
(...skipping 19 matching lines...) Expand all
127 DCHECK(is_initialized_); 127 DCHECK(is_initialized_);
128 DCHECK(!is_shutdown_); 128 DCHECK(!is_shutdown_);
129 g_exited_main_message_loop = true; 129 g_exited_main_message_loop = true;
130 130
131 if (created_threads_) 131 if (created_threads_)
132 main_loop_->ShutdownThreadsAndCleanUp(); 132 main_loop_->ShutdownThreadsAndCleanUp();
133 133
134 #if defined(OS_WIN) 134 #if defined(OS_WIN)
135 if (base::win::IsTsfAwareRequired()) 135 if (base::win::IsTsfAwareRequired())
136 ui::TsfBridge::GetInstance()->Shutdown(); 136 ui::TsfBridge::GetInstance()->Shutdown();
137 com_initializer_.reset(NULL); 137 ole_initializer_.reset(NULL);
138 #endif 138 #endif
139 139
140 main_loop_.reset(NULL); 140 main_loop_.reset(NULL);
141 141
142 notification_service_.reset(NULL); 142 notification_service_.reset(NULL);
143 143
144 is_shutdown_ = true; 144 is_shutdown_ = true;
145 } 145 }
146 146
147 protected: 147 protected:
148 // True if the runner has been initialized. 148 // True if the runner has been initialized.
149 bool is_initialized_; 149 bool is_initialized_;
150 150
151 // True if the runner has been shut down. 151 // True if the runner has been shut down.
152 bool is_shutdown_; 152 bool is_shutdown_;
153 153
154 // True if the non-UI threads were created. 154 // True if the non-UI threads were created.
155 bool created_threads_; 155 bool created_threads_;
156 156
157 scoped_ptr<NotificationServiceImpl> notification_service_; 157 scoped_ptr<NotificationServiceImpl> notification_service_;
158 scoped_ptr<content::BrowserMainLoop> main_loop_; 158 scoped_ptr<content::BrowserMainLoop> main_loop_;
159 #if defined(OS_WIN) 159 #if defined(OS_WIN)
160 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; 160 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_;
161 #endif 161 #endif
162 162
163 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); 163 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl);
164 }; 164 };
165 165
166 } // namespace 166 } // namespace
167 167
168 namespace content { 168 namespace content {
169 169
170 // static 170 // static
171 BrowserMainRunner* BrowserMainRunner::Create() { 171 BrowserMainRunner* BrowserMainRunner::Create() {
172 return new BrowserMainRunnerImpl(); 172 return new BrowserMainRunnerImpl();
173 } 173 }
174 174
175 } // namespace content 175 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698