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

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

Issue 7529003: Make base::MessageLoops have names at construction time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make message loop name optional. Created 9 years, 4 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 | « base/threading/thread.cc ('k') | chrome/nacl/nacl_main.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 "chrome/browser/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/allocator/allocator_shim.h" 11 #include "base/allocator/allocator_shim.h"
12 #include "base/at_exit.h" 12 #include "base/at_exit.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/file_util.h" 16 #include "base/file_util.h"
17 #include "base/mac/scoped_nsautorelease_pool.h" 17 #include "base/mac/scoped_nsautorelease_pool.h"
18 #include "base/metrics/field_trial.h" 18 #include "base/metrics/field_trial.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/process_util.h" 21 #include "base/process_util.h"
22 #include "base/string_number_conversions.h" 22 #include "base/string_number_conversions.h"
23 #include "base/string_piece.h" 23 #include "base/string_piece.h"
24 #include "base/string_split.h" 24 #include "base/string_split.h"
25 #include "base/string_util.h" 25 #include "base/string_util.h"
26 #include "base/sys_string_conversions.h" 26 #include "base/sys_string_conversions.h"
27 #include "base/system_monitor/system_monitor.h" 27 #include "base/system_monitor/system_monitor.h"
28 #include "base/threading/platform_thread.h"
29 #include "base/threading/thread_restrictions.h" 28 #include "base/threading/thread_restrictions.h"
30 #include "base/time.h" 29 #include "base/time.h"
31 #include "base/utf_string_conversions.h" 30 #include "base/utf_string_conversions.h"
32 #include "base/values.h" 31 #include "base/values.h"
33 #include "build/build_config.h" 32 #include "build/build_config.h"
34 #include "chrome/browser/about_flags.h" 33 #include "chrome/browser/about_flags.h"
35 #include "chrome/browser/browser_main_win.h" 34 #include "chrome/browser/browser_main_win.h"
36 #include "chrome/browser/browser_process.h" 35 #include "chrome/browser/browser_process.h"
37 #include "chrome/browser/browser_process_impl.h" 36 #include "chrome/browser/browser_process_impl.h"
38 #include "chrome/browser/browser_shutdown.h" 37 #include "chrome/browser/browser_shutdown.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 kSuggestPrefixDivisor, "Default_Prefix", 2012, 1, 1)); 571 kSuggestPrefixDivisor, "Default_Prefix", 2012, 1, 1));
573 trial->AppendGroup("Www_Prefix", kSuggestPrefixProbability); 572 trial->AppendGroup("Www_Prefix", kSuggestPrefixProbability);
574 // The field trial is detected directly, so we don't need to call anything. 573 // The field trial is detected directly, so we don't need to call anything.
575 } 574 }
576 575
577 // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- 576 // BrowserMainParts: |MainMessageLoopStart()| and related ----------------------
578 577
579 void BrowserMainParts::MainMessageLoopStart() { 578 void BrowserMainParts::MainMessageLoopStart() {
580 PreMainMessageLoopStart(); 579 PreMainMessageLoopStart();
581 580
582 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); 581 main_message_loop_.reset(
582 new MessageLoop("CrBrowserMain", MessageLoop::TYPE_UI));
583 583
584 // TODO(viettrungluu): should these really go before setting the thread name? 584 // TODO(viettrungluu): should these really go before setting the thread name?
585 system_monitor_.reset(new base::SystemMonitor); 585 system_monitor_.reset(new base::SystemMonitor);
586 hi_res_timer_manager_.reset(new HighResolutionTimerManager); 586 hi_res_timer_manager_.reset(new HighResolutionTimerManager);
587 587
588 InitializeMainThread(); 588 InitializeMainThread();
589 589
590 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 590 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
591 591
592 PostMainMessageLoopStart(); 592 PostMainMessageLoopStart();
593 Profiling::MainMessageLoopStarted(); 593 Profiling::MainMessageLoopStarted();
594 } 594 }
595 595
596 void BrowserMainParts::InitializeMainThread() { 596 void BrowserMainParts::InitializeMainThread() {
597 const char* kThreadName = "CrBrowserMain";
598 base::PlatformThread::SetName(kThreadName);
599 main_message_loop().set_thread_name(kThreadName);
600
601 // Register the main thread by instantiating it, but don't call any methods. 597 // Register the main thread by instantiating it, but don't call any methods.
602 main_thread_.reset(new BrowserThread(BrowserThread::UI, 598 main_thread_.reset(new BrowserThread(BrowserThread::UI,
603 MessageLoop::current())); 599 MessageLoop::current()));
604 } 600 }
605 601
606 // BrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------------- 602 // BrowserMainParts: |SetupMetricsAndFieldTrials()| related --------------------
607 603
608 // Initializes the metrics service with the configuration for this process, 604 // Initializes the metrics service with the configuration for this process,
609 // returning the created service (guaranteed non-NULL). 605 // returning the created service (guaranteed non-NULL).
610 MetricsService* BrowserMainParts::InitializeMetrics( 606 MetricsService* BrowserMainParts::InitializeMetrics(
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 #if defined(OS_CHROMEOS) 2114 #if defined(OS_CHROMEOS)
2119 // To be precise, logout (browser shutdown) is not yet done, but the 2115 // To be precise, logout (browser shutdown) is not yet done, but the
2120 // remaining work is negligible, hence we say LogoutDone here. 2116 // remaining work is negligible, hence we say LogoutDone here.
2121 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 2117 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
2122 false); 2118 false);
2123 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 2119 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
2124 #endif 2120 #endif
2125 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); 2121 TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
2126 return result_code; 2122 return result_code;
2127 } 2123 }
OLDNEW
« no previous file with comments | « base/threading/thread.cc ('k') | chrome/nacl/nacl_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698