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

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

Issue 8210004: Assert that new renderer processes aren't created during shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 9 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.h ('k') | content/browser/renderer_host/render_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/browser_main.h" 5 #include "content/browser/browser_main.h"
6 6
7 #include "base/allocator/allocator_shim.h" 7 #include "base/allocator/allocator_shim.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 system_monitor_.reset(new base::SystemMonitor); 245 system_monitor_.reset(new base::SystemMonitor);
246 hi_res_timer_manager_.reset(new HighResolutionTimerManager); 246 hi_res_timer_manager_.reset(new HighResolutionTimerManager);
247 247
248 InitializeMainThread(); 248 InitializeMainThread();
249 249
250 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 250 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
251 251
252 PostMainMessageLoopStart(); 252 PostMainMessageLoopStart();
253 } 253 }
254 254
255 static bool g_exited_main_message_loop = false;
256
255 void BrowserMainParts::RunMainMessageLoopParts() { 257 void BrowserMainParts::RunMainMessageLoopParts() {
256 PreMainMessageLoopRun(); 258 PreMainMessageLoopRun();
257 259
258 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); 260 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, "");
259 // If the UI thread blocks, the whole UI is unresponsive. 261 // If the UI thread blocks, the whole UI is unresponsive.
260 // Do not allow disk IO from the UI thread. 262 // Do not allow disk IO from the UI thread.
261 base::ThreadRestrictions::SetIOAllowed(false); 263 base::ThreadRestrictions::SetIOAllowed(false);
262 MainMessageLoopRun(); 264 MainMessageLoopRun();
263 TRACE_EVENT_END_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); 265 TRACE_EVENT_END_ETW("BrowserMain:MESSAGE_LOOP", 0, "");
264 266
267 g_exited_main_message_loop = true;
268
265 PostMainMessageLoopRun(); 269 PostMainMessageLoopRun();
266 } 270 }
267 271
268 void BrowserMainParts::InitializeMainThread() { 272 void BrowserMainParts::InitializeMainThread() {
269 const char* kThreadName = "CrBrowserMain"; 273 const char* kThreadName = "CrBrowserMain";
270 base::PlatformThread::SetName(kThreadName); 274 base::PlatformThread::SetName(kThreadName);
271 main_message_loop().set_thread_name(kThreadName); 275 main_message_loop().set_thread_name(kThreadName);
272 276
273 // Register the main thread by instantiating it, but don't call any methods. 277 // Register the main thread by instantiating it, but don't call any methods.
274 main_thread_.reset(new BrowserThread(BrowserThread::UI, 278 main_thread_.reset(new BrowserThread(BrowserThread::UI,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 MessageLoopForUI::current()->Run(NULL); 354 MessageLoopForUI::current()->Run(NULL);
351 #endif 355 #endif
352 } 356 }
353 357
354 void BrowserMainParts::PostMainMessageLoopRun() { 358 void BrowserMainParts::PostMainMessageLoopRun() {
355 } 359 }
356 360
357 void BrowserMainParts::ToolkitInitialized() { 361 void BrowserMainParts::ToolkitInitialized() {
358 } 362 }
359 363
364 bool ExitedMainMessageLoop() {
365 return g_exited_main_message_loop;
366 }
367
360 } // namespace content 368 } // namespace content
361 369
362 // Main routine for running as the Browser process. 370 // Main routine for running as the Browser process.
363 int BrowserMain(const MainFunctionParams& parameters) { 371 int BrowserMain(const MainFunctionParams& parameters) {
364 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); 372 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, "");
365 373
366 NotificationService main_notification_service; 374 NotificationService main_notification_service;
367 375
368 scoped_ptr<content::BrowserMainParts> parts( 376 scoped_ptr<content::BrowserMainParts> parts(
369 content::GetContentClient()->browser()->CreateBrowserMainParts( 377 content::GetContentClient()->browser()->CreateBrowserMainParts(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 base::win::ScopedCOMInitializer com_initializer; 428 base::win::ScopedCOMInitializer com_initializer;
421 #endif // OS_WIN 429 #endif // OS_WIN
422 430
423 base::StatisticsRecorder statistics; 431 base::StatisticsRecorder statistics;
424 432
425 parts->RunMainMessageLoopParts(); 433 parts->RunMainMessageLoopParts();
426 434
427 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); 435 TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
428 return parts->result_code(); 436 return parts->result_code();
429 } 437 }
OLDNEW
« no previous file with comments | « content/browser/browser_main.h ('k') | content/browser/renderer_host/render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698