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 "base/tracked_objects.h" | |
15 #include "content/browser/browser_thread_impl.h" | 14 #include "content/browser/browser_thread_impl.h" |
16 #include "content/browser/trace_controller.h" | 15 #include "content/browser/trace_controller.h" |
17 #include "content/common/hi_res_timer_manager.h" | 16 #include "content/common/hi_res_timer_manager.h" |
18 #include "content/common/sandbox_policy.h" | 17 #include "content/common/sandbox_policy.h" |
19 #include "content/public/browser/browser_main_parts.h" | 18 #include "content/public/browser/browser_main_parts.h" |
20 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
21 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
22 #include "content/public/common/main_function_params.h" | 21 #include "content/public/common/main_function_params.h" |
23 #include "content/public/common/result_codes.h" | 22 #include "content/public/common/result_codes.h" |
24 #include "crypto/nss_util.h" | 23 #include "crypto/nss_util.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 *completed_main_message_loop = true; | 294 *completed_main_message_loop = true; |
296 | 295 |
297 for (size_t i = 0; i < parts_list_.size(); ++i) | 296 for (size_t i = 0; i < parts_list_.size(); ++i) |
298 parts_list_[i]->PostMainMessageLoopRun(); | 297 parts_list_[i]->PostMainMessageLoopRun(); |
299 } | 298 } |
300 | 299 |
301 void BrowserMainLoop::InitializeMainThread() { | 300 void BrowserMainLoop::InitializeMainThread() { |
302 const char* kThreadName = "CrBrowserMain"; | 301 const char* kThreadName = "CrBrowserMain"; |
303 base::PlatformThread::SetName(kThreadName); | 302 base::PlatformThread::SetName(kThreadName); |
304 main_message_loop_->set_thread_name(kThreadName); | 303 main_message_loop_->set_thread_name(kThreadName); |
305 tracked_objects::ThreadData::InitializeThreadContext(kThreadName); | |
306 | 304 |
307 // Register the main thread by instantiating it, but don't call any methods. | 305 // Register the main thread by instantiating it, but don't call any methods. |
308 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, | 306 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, |
309 MessageLoop::current())); | 307 MessageLoop::current())); |
310 } | 308 } |
311 | 309 |
312 void BrowserMainLoop::InitializeToolkit() { | 310 void BrowserMainLoop::InitializeToolkit() { |
313 // TODO(evan): this function is rather subtle, due to the variety | 311 // TODO(evan): this function is rather subtle, due to the variety |
314 // of intersecting ifdefs we have. To keep it easy to follow, there | 312 // of intersecting ifdefs we have. To keep it easy to follow, there |
315 // are no #else branches on any #ifs. | 313 // are no #else branches on any #ifs. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); | 352 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); |
355 | 353 |
356 #if defined(OS_MACOSX) | 354 #if defined(OS_MACOSX) |
357 MessageLoopForUI::current()->Run(); | 355 MessageLoopForUI::current()->Run(); |
358 #else | 356 #else |
359 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 357 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
360 #endif | 358 #endif |
361 } | 359 } |
362 | 360 |
363 } // namespace content | 361 } // namespace content |
OLD | NEW |