| 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 "base/tracked_objects.h" |
| 15 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread_impl.h" |
| 16 #include "content/common/hi_res_timer_manager.h" | 16 #include "content/common/hi_res_timer_manager.h" |
| 17 #include "content/common/main_function_params.h" | 17 #include "content/common/main_function_params.h" |
| 18 #include "content/common/sandbox_policy.h" | 18 #include "content/common/sandbox_policy.h" |
| 19 #include "content/public/browser/browser_main_parts.h" | 19 #include "content/public/browser/browser_main_parts.h" |
| 20 #include "content/public/browser/content_browser_client.h" | 20 #include "content/public/browser/content_browser_client.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/common/result_codes.h" | 22 #include "content/public/common/result_codes.h" |
| 23 #include "crypto/nss_util.h" | 23 #include "crypto/nss_util.h" |
| 24 #include "net/base/network_change_notifier.h" | 24 #include "net/base/network_change_notifier.h" |
| 25 #include "net/base/ssl_config_service.h" | 25 #include "net/base/ssl_config_service.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void BrowserMainLoop::InitializeMainThread() { | 288 void BrowserMainLoop::InitializeMainThread() { |
| 289 const char* kThreadName = "CrBrowserMain"; | 289 const char* kThreadName = "CrBrowserMain"; |
| 290 base::PlatformThread::SetName(kThreadName); | 290 base::PlatformThread::SetName(kThreadName); |
| 291 main_message_loop_->set_thread_name(kThreadName); | 291 main_message_loop_->set_thread_name(kThreadName); |
| 292 | 292 |
| 293 #if defined(TRACK_ALL_TASK_OBJECTS) | 293 #if defined(TRACK_ALL_TASK_OBJECTS) |
| 294 tracked_objects::ThreadData::InitializeThreadContext(kThreadName); | 294 tracked_objects::ThreadData::InitializeThreadContext(kThreadName); |
| 295 #endif // TRACK_ALL_TASK_OBJECTS | 295 #endif // TRACK_ALL_TASK_OBJECTS |
| 296 | 296 |
| 297 // Register the main thread by instantiating it, but don't call any methods. | 297 // Register the main thread by instantiating it, but don't call any methods. |
| 298 main_thread_.reset(new BrowserThread(BrowserThread::UI, | 298 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, |
| 299 MessageLoop::current())); | 299 MessageLoop::current())); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void BrowserMainLoop::InitializeToolkit() { | 302 void BrowserMainLoop::InitializeToolkit() { |
| 303 // TODO(evan): this function is rather subtle, due to the variety | 303 // TODO(evan): this function is rather subtle, due to the variety |
| 304 // of intersecting ifdefs we have. To keep it easy to follow, there | 304 // of intersecting ifdefs we have. To keep it easy to follow, there |
| 305 // are no #else branches on any #ifs. | 305 // are no #else branches on any #ifs. |
| 306 // TODO(stevenjb): Move platform specific code into platform specific Parts | 306 // TODO(stevenjb): Move platform specific code into platform specific Parts |
| 307 // (Need to add InitializeToolkit stage to BrowserParts). | 307 // (Need to add InitializeToolkit stage to BrowserParts). |
| 308 #if defined(OS_LINUX) | 308 #if defined(OS_LINUX) |
| 309 // We want to call g_thread_init(), but in some codepaths (tests) it | 309 // We want to call g_thread_init(), but in some codepaths (tests) it |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); | 359 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); |
| 360 | 360 |
| 361 #if defined(OS_MACOSX) | 361 #if defined(OS_MACOSX) |
| 362 MessageLoopForUI::current()->Run(); | 362 MessageLoopForUI::current()->Run(); |
| 363 #else | 363 #else |
| 364 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 364 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
| 365 #endif | 365 #endif |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace content | 368 } // namespace content |
| OLD | NEW |