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