OLD | NEW |
---|---|
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_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "content/browser/browser_thread_impl.h" | 14 #include "content/browser/browser_thread_impl.h" |
15 #include "content/browser/trace_controller.h" | 15 #include "content/browser/trace_controller.h" |
16 #include "content/common/hi_res_timer_manager.h" | 16 #include "content/common/hi_res_timer_manager.h" |
17 #include "content/common/sandbox_policy.h" | 17 #include "content/common/sandbox_policy.h" |
18 #include "content/public/browser/browser_main_parts.h" | 18 #include "content/public/browser/browser_main_parts.h" |
19 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
20 #include "content/public/browser/notification_service.h" | |
21 #include "content/public/browser/notification_types.h" | |
20 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
21 #include "content/public/common/main_function_params.h" | 23 #include "content/public/common/main_function_params.h" |
22 #include "content/public/common/result_codes.h" | 24 #include "content/public/common/result_codes.h" |
23 #include "crypto/nss_util.h" | 25 #include "crypto/nss_util.h" |
24 #include "net/base/network_change_notifier.h" | 26 #include "net/base/network_change_notifier.h" |
25 #include "net/base/ssl_config_service.h" | 27 #include "net/base/ssl_config_service.h" |
26 #include "net/socket/client_socket_factory.h" | 28 #include "net/socket/client_socket_factory.h" |
27 #include "net/socket/tcp_client_socket.h" | 29 #include "net/socket/tcp_client_socket.h" |
28 | 30 |
29 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 if (!ran_main_loop) | 290 if (!ran_main_loop) |
289 MainMessageLoopRun(); | 291 MainMessageLoopRun(); |
290 | 292 |
291 TRACE_EVENT_END_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 293 TRACE_EVENT_END_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
292 | 294 |
293 if (completed_main_message_loop) | 295 if (completed_main_message_loop) |
294 *completed_main_message_loop = true; | 296 *completed_main_message_loop = true; |
295 | 297 |
296 for (size_t i = 0; i < parts_list_.size(); ++i) | 298 for (size_t i = 0; i < parts_list_.size(); ++i) |
297 parts_list_[i]->PostMainMessageLoopRun(); | 299 parts_list_[i]->PostMainMessageLoopRun(); |
300 | |
301 NotificationService::current()->Notify( | |
pfeldman
2011/11/21 14:52:21
Could we use a simple singleton instead?
yurys
2011/11/21 15:07:14
As I wrote I'm going to resolve it in a separate c
| |
302 NOTIFICATION_MAIN_MESSAGE_LOOP_EXITING, | |
303 NotificationService::AllSources(), | |
304 NotificationService::NoDetails()); | |
298 } | 305 } |
299 | 306 |
300 void BrowserMainLoop::InitializeMainThread() { | 307 void BrowserMainLoop::InitializeMainThread() { |
301 const char* kThreadName = "CrBrowserMain"; | 308 const char* kThreadName = "CrBrowserMain"; |
302 base::PlatformThread::SetName(kThreadName); | 309 base::PlatformThread::SetName(kThreadName); |
303 main_message_loop_->set_thread_name(kThreadName); | 310 main_message_loop_->set_thread_name(kThreadName); |
304 | 311 |
305 // Register the main thread by instantiating it, but don't call any methods. | 312 // Register the main thread by instantiating it, but don't call any methods. |
306 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, | 313 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, |
307 MessageLoop::current())); | 314 MessageLoop::current())); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); | 359 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); |
353 | 360 |
354 #if defined(OS_MACOSX) | 361 #if defined(OS_MACOSX) |
355 MessageLoopForUI::current()->Run(); | 362 MessageLoopForUI::current()->Run(); |
356 #else | 363 #else |
357 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 364 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
358 #endif | 365 #endif |
359 } | 366 } |
360 | 367 |
361 } // namespace content | 368 } // namespace content |
OLD | NEW |