| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/browser/browser_main_runner.h" | 5 #include "content/public/browser/browser_main_runner.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
| 10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 35 #include "content/browser/android/tracing_controller_android.h" | 35 #include "content/browser/android/tracing_controller_android.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 39 #include "base/win/windows_version.h" | 39 #include "base/win/windows_version.h" |
| 40 #include "ui/base/win/scoped_ole_initializer.h" | 40 #include "ui/base/win/scoped_ole_initializer.h" |
| 41 #include "ui/gfx/win/direct_write.h" | 41 #include "ui/gfx/win/direct_write.h" |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 namespace mojo { namespace edk { extern bool g_extra_debugging; } } |
| 45 |
| 44 namespace content { | 46 namespace content { |
| 45 | 47 |
| 46 namespace { | 48 namespace { |
| 47 | 49 |
| 48 bool g_exited_main_message_loop = false; | 50 bool g_exited_main_message_loop = false; |
| 49 const char kMainThreadName[] = "CrBrowserMain"; | 51 const char kMainThreadName[] = "CrBrowserMain"; |
| 50 | 52 |
| 51 } // namespace | 53 } // namespace |
| 52 | 54 |
| 53 class BrowserMainRunnerImpl : public BrowserMainRunner { | 55 class BrowserMainRunnerImpl : public BrowserMainRunner { |
| 54 public: | 56 public: |
| 55 BrowserMainRunnerImpl() | 57 BrowserMainRunnerImpl() |
| 56 : initialization_started_(false), is_shutdown_(false) {} | 58 : initialization_started_(false), is_shutdown_(false) {} |
| 57 | 59 |
| 58 ~BrowserMainRunnerImpl() override { | 60 ~BrowserMainRunnerImpl() override { |
| 59 if (initialization_started_ && !is_shutdown_) | 61 if (initialization_started_ && !is_shutdown_) |
| 60 Shutdown(); | 62 Shutdown(); |
| 61 } | 63 } |
| 62 | 64 |
| 63 int Initialize(const MainFunctionParams& parameters) override { | 65 int Initialize(const MainFunctionParams& parameters) override { |
| 66 mojo::edk::g_extra_debugging = true; |
| 64 SCOPED_UMA_HISTOGRAM_LONG_TIMER( | 67 SCOPED_UMA_HISTOGRAM_LONG_TIMER( |
| 65 "Startup.BrowserMainRunnerImplInitializeLongTime"); | 68 "Startup.BrowserMainRunnerImplInitializeLongTime"); |
| 66 | 69 |
| 67 // TODO(vadimt, yiyaoliu): Remove all tracked_objects references below once | 70 // TODO(vadimt, yiyaoliu): Remove all tracked_objects references below once |
| 68 // crbug.com/453640 is fixed. | 71 // crbug.com/453640 is fixed. |
| 69 tracked_objects::ThreadData::InitializeThreadContext(kMainThreadName); | 72 tracked_objects::ThreadData::InitializeThreadContext(kMainThreadName); |
| 70 base::trace_event::AllocationContextTracker::SetCurrentThreadName( | 73 base::trace_event::AllocationContextTracker::SetCurrentThreadName( |
| 71 kMainThreadName); | 74 kMainThreadName); |
| 72 TRACK_SCOPED_REGION( | 75 TRACK_SCOPED_REGION( |
| 73 "Startup", "BrowserMainRunnerImpl::Initialize"); | 76 "Startup", "BrowserMainRunnerImpl::Initialize"); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 BrowserMainRunner* BrowserMainRunner::Create() { | 253 BrowserMainRunner* BrowserMainRunner::Create() { |
| 251 return new BrowserMainRunnerImpl(); | 254 return new BrowserMainRunnerImpl(); |
| 252 } | 255 } |
| 253 | 256 |
| 254 // static | 257 // static |
| 255 bool BrowserMainRunner::ExitedMainMessageLoop() { | 258 bool BrowserMainRunner::ExitedMainMessageLoop() { |
| 256 return g_exited_main_message_loop; | 259 return g_exited_main_message_loop; |
| 257 } | 260 } |
| 258 | 261 |
| 259 } // namespace content | 262 } // namespace content |
| OLD | NEW |