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

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

Issue 2810763002: gpu: Do not relaunch the process during teardown. (Closed)
Patch Set: AtomicFlag Created 3 years, 8 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
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('j') | 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/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/debugger.h" 9 #include "base/debug/debugger.h"
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
(...skipping 26 matching lines...) Expand all
37 #if defined(OS_WIN) 37 #if defined(OS_WIN)
38 #include "base/win/windows_version.h" 38 #include "base/win/windows_version.h"
39 #include "ui/base/win/scoped_ole_initializer.h" 39 #include "ui/base/win/scoped_ole_initializer.h"
40 #include "ui/gfx/win/direct_write.h" 40 #include "ui/gfx/win/direct_write.h"
41 #endif 41 #endif
42 42
43 namespace content { 43 namespace content {
44 44
45 namespace { 45 namespace {
46 46
47 bool g_exited_main_message_loop = false; 47 base::LazyInstance<base::AtomicFlag>::Leaky g_exited_main_message_loop;
48 const char kMainThreadName[] = "CrBrowserMain"; 48 const char kMainThreadName[] = "CrBrowserMain";
49 49
50 } // namespace 50 } // namespace
51 51
52 class BrowserMainRunnerImpl : public BrowserMainRunner { 52 class BrowserMainRunnerImpl : public BrowserMainRunner {
53 public: 53 public:
54 BrowserMainRunnerImpl() 54 BrowserMainRunnerImpl()
55 : initialization_started_(false), is_shutdown_(false) {} 55 : initialization_started_(false), is_shutdown_(false) {}
56 56
57 ~BrowserMainRunnerImpl() override { 57 ~BrowserMainRunnerImpl() override {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 *base::CommandLine::ForCurrentProcess(); 188 *base::CommandLine::ForCurrentProcess();
189 std::unique_ptr<BrowserShutdownProfileDumper> shutdown_profiler; 189 std::unique_ptr<BrowserShutdownProfileDumper> shutdown_profiler;
190 if (command_line.HasSwitch(switches::kTraceShutdown)) { 190 if (command_line.HasSwitch(switches::kTraceShutdown)) {
191 shutdown_profiler.reset(new BrowserShutdownProfileDumper( 191 shutdown_profiler.reset(new BrowserShutdownProfileDumper(
192 BrowserShutdownProfileDumper::GetShutdownProfileFileName())); 192 BrowserShutdownProfileDumper::GetShutdownProfileFileName()));
193 } 193 }
194 194
195 { 195 {
196 // The trace event has to stay between profiler creation and destruction. 196 // The trace event has to stay between profiler creation and destruction.
197 TRACE_EVENT0("shutdown", "BrowserMainRunner"); 197 TRACE_EVENT0("shutdown", "BrowserMainRunner");
198 g_exited_main_message_loop = true; 198 g_exited_main_message_loop.Get().Set();
199 199
200 main_loop_->ShutdownThreadsAndCleanUp(); 200 main_loop_->ShutdownThreadsAndCleanUp();
201 201
202 ui::ShutdownInputMethod(); 202 ui::ShutdownInputMethod();
203 #if defined(OS_WIN) 203 #if defined(OS_WIN)
204 ole_initializer_.reset(NULL); 204 ole_initializer_.reset(NULL);
205 #endif 205 #endif
206 #if defined(OS_ANDROID) 206 #if defined(OS_ANDROID)
207 // Forcefully terminates the RunLoop inside MessagePumpForUI, ensuring 207 // Forcefully terminates the RunLoop inside MessagePumpForUI, ensuring
208 // proper shutdown for content_browsertests. Shutdown() is not used by 208 // proper shutdown for content_browsertests. Shutdown() is not used by
(...skipping 26 matching lines...) Expand all
235 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); 235 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl);
236 }; 236 };
237 237
238 // static 238 // static
239 BrowserMainRunner* BrowserMainRunner::Create() { 239 BrowserMainRunner* BrowserMainRunner::Create() {
240 return new BrowserMainRunnerImpl(); 240 return new BrowserMainRunnerImpl();
241 } 241 }
242 242
243 // static 243 // static
244 bool BrowserMainRunner::ExitedMainMessageLoop() { 244 bool BrowserMainRunner::ExitedMainMessageLoop() {
245 return g_exited_main_message_loop; 245 return !(g_exited_main_message_loop == nullptr) &&
246 g_exited_main_message_loop.Get().IsSet();
246 } 247 }
247 248
248 } // namespace content 249 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698