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" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 // Must first NULL pointer or we hit a DCHECK that the newly constructed | 242 // Must first NULL pointer or we hit a DCHECK that the newly constructed |
243 // message loop is the current one. | 243 // message loop is the current one. |
244 main_message_loop_.reset(); | 244 main_message_loop_.reset(); |
245 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 245 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
246 | 246 |
247 InitializeMainThread(); | 247 InitializeMainThread(); |
248 | 248 |
249 system_monitor_.reset(new base::SystemMonitor); | 249 system_monitor_.reset(new base::SystemMonitor); |
250 hi_res_timer_manager_.reset(new HighResolutionTimerManager); | 250 hi_res_timer_manager_.reset(new HighResolutionTimerManager); |
251 | 251 |
252 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | |
253 | |
254 for (size_t i = 0; i < parts_list_.size(); ++i) | 252 for (size_t i = 0; i < parts_list_.size(); ++i) |
255 parts_list_[i]->PostMainMessageLoopStart(); | 253 parts_list_[i]->PostMainMessageLoopStart(); |
254 | |
255 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | |
satorux1
2011/11/02 05:07:48
I thought we wanted to move this to RunMainMessage
| |
256 } | 256 } |
257 | 257 |
258 void BrowserMainLoop::RunMainMessageLoopParts( | 258 void BrowserMainLoop::RunMainMessageLoopParts( |
259 bool* completed_main_message_loop) { | 259 bool* completed_main_message_loop) { |
260 for (size_t i = 0; i < parts_list_.size(); ++i) | 260 for (size_t i = 0; i < parts_list_.size(); ++i) |
261 parts_list_[i]->PreMainMessageLoopRun(); | 261 parts_list_[i]->PreMainMessageLoopRun(); |
262 | 262 |
satorux1
2011/11/02 05:07:48
somewhere like here?
| |
263 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 263 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
264 // If the UI thread blocks, the whole UI is unresponsive. | 264 // If the UI thread blocks, the whole UI is unresponsive. |
265 // Do not allow disk IO from the UI thread. | 265 // Do not allow disk IO from the UI thread. |
266 base::ThreadRestrictions::SetIOAllowed(false); | 266 base::ThreadRestrictions::SetIOAllowed(false); |
267 | 267 |
268 // Iterate through each of the parts. If any of them ran the main | 268 // Iterate through each of the parts. If any of them ran the main |
269 // message loop then they should return |true|. Otherwise | 269 // message loop then they should return |true|. Otherwise |
270 // BrowserMainLoop::MainMessageLoopRun loop will be run. | 270 // BrowserMainLoop::MainMessageLoopRun loop will be run. |
271 bool ran_main_loop = false; | 271 bool ran_main_loop = false; |
272 for (size_t i = 0; i < parts_list_.size(); ++i) { | 272 for (size_t i = 0; i < parts_list_.size(); ++i) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); | 362 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); |
363 | 363 |
364 #if defined(OS_MACOSX) | 364 #if defined(OS_MACOSX) |
365 MessageLoopForUI::current()->Run(); | 365 MessageLoopForUI::current()->Run(); |
366 #else | 366 #else |
367 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 367 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
368 #endif | 368 #endif |
369 } | 369 } |
370 | 370 |
371 } // namespace content | 371 } // namespace content |
OLD | NEW |