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