| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
| 15 #include "base/profiler/scoped_profile.h" | 15 #include "base/profiler/scoped_profile.h" |
| 16 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 18 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 19 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
| 20 #include "base/tracked_objects.h" | 20 #include "base/tracked_objects.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "components/tracing/common/trace_config_file.h" | 22 #include "components/tracing/common/trace_config_file.h" |
| 23 #include "components/tracing/common/tracing_switches.h" | 23 #include "components/tracing/common/tracing_switches.h" |
| 24 #include "content/browser/browser_main_loop.h" | 24 #include "content/browser/browser_main_loop.h" |
| 25 #include "content/browser/browser_shutdown_profile_dumper.h" | 25 #include "content/browser/browser_shutdown_profile_dumper.h" |
| 26 #include "content/browser/notification_service_impl.h" | 26 #include "content/browser/notification_service_impl.h" |
| 27 #include "content/public/browser/tracing_controller.h" | 27 #include "content/public/browser/tracing_controller.h" |
| 28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
| 29 #include "content/public/common/main_function_params.h" | 29 #include "content/public/common/main_function_params.h" |
| 30 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" |
| 30 #include "third_party/skia/include/core/SkGraphics.h" | 31 #include "third_party/skia/include/core/SkGraphics.h" |
| 31 #include "ui/base/ime/input_method_initializer.h" | 32 #include "ui/base/ime/input_method_initializer.h" |
| 32 | 33 |
| 33 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 34 #include "content/browser/android/tracing_controller_android.h" | 35 #include "content/browser/android/tracing_controller_android.h" |
| 35 #endif | 36 #endif |
| 36 | 37 |
| 37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 38 #include "base/win/windows_version.h" | 39 #include "base/win/windows_version.h" |
| 39 #include "ui/base/win/scoped_ole_initializer.h" | 40 #include "ui/base/win/scoped_ole_initializer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 53 public: | 54 public: |
| 54 BrowserMainRunnerImpl() | 55 BrowserMainRunnerImpl() |
| 55 : initialization_started_(false), is_shutdown_(false) {} | 56 : initialization_started_(false), is_shutdown_(false) {} |
| 56 | 57 |
| 57 ~BrowserMainRunnerImpl() override { | 58 ~BrowserMainRunnerImpl() override { |
| 58 if (initialization_started_ && !is_shutdown_) | 59 if (initialization_started_ && !is_shutdown_) |
| 59 Shutdown(); | 60 Shutdown(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 int Initialize(const MainFunctionParams& parameters) override { | 63 int Initialize(const MainFunctionParams& parameters) override { |
| 64 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_calls; |
| 63 SCOPED_UMA_HISTOGRAM_LONG_TIMER( | 65 SCOPED_UMA_HISTOGRAM_LONG_TIMER( |
| 64 "Startup.BrowserMainRunnerImplInitializeLongTime"); | 66 "Startup.BrowserMainRunnerImplInitializeLongTime"); |
| 65 | 67 |
| 66 // TODO(vadimt, yiyaoliu): Remove all tracked_objects references below once | 68 // TODO(vadimt, yiyaoliu): Remove all tracked_objects references below once |
| 67 // crbug.com/453640 is fixed. | 69 // crbug.com/453640 is fixed. |
| 68 tracked_objects::ThreadData::InitializeThreadContext(kMainThreadName); | 70 tracked_objects::ThreadData::InitializeThreadContext(kMainThreadName); |
| 69 base::trace_event::AllocationContextTracker::SetCurrentThreadName( | 71 base::trace_event::AllocationContextTracker::SetCurrentThreadName( |
| 70 kMainThreadName); | 72 kMainThreadName); |
| 71 TRACK_SCOPED_REGION( | 73 TRACK_SCOPED_REGION( |
| 72 "Startup", "BrowserMainRunnerImpl::Initialize"); | 74 "Startup", "BrowserMainRunnerImpl::Initialize"); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 BrowserMainRunner* BrowserMainRunner::Create() { | 241 BrowserMainRunner* BrowserMainRunner::Create() { |
| 240 return new BrowserMainRunnerImpl(); | 242 return new BrowserMainRunnerImpl(); |
| 241 } | 243 } |
| 242 | 244 |
| 243 // static | 245 // static |
| 244 bool BrowserMainRunner::ExitedMainMessageLoop() { | 246 bool BrowserMainRunner::ExitedMainMessageLoop() { |
| 245 return g_exited_main_message_loop; | 247 return g_exited_main_message_loop; |
| 246 } | 248 } |
| 247 | 249 |
| 248 } // namespace content | 250 } // namespace content |
| OLD | NEW |