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/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/metrics/statistics_recorder.h" | 12 #include "base/metrics/statistics_recorder.h" |
| 13 #include "base/profiler/scoped_tracker.h" |
13 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "base/tracked_objects.h" |
14 #include "content/browser/browser_main_loop.h" | 16 #include "content/browser/browser_main_loop.h" |
15 #include "content/browser/browser_shutdown_profile_dumper.h" | 17 #include "content/browser/browser_shutdown_profile_dumper.h" |
16 #include "content/browser/notification_service_impl.h" | 18 #include "content/browser/notification_service_impl.h" |
17 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/main_function_params.h" | 20 #include "content/public/common/main_function_params.h" |
19 #include "ui/base/ime/input_method_initializer.h" | 21 #include "ui/base/ime/input_method_initializer.h" |
20 | 22 |
21 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
22 #include "base/win/win_util.h" | 24 #include "base/win/win_util.h" |
23 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 public: | 121 public: |
120 BrowserMainRunnerImpl() | 122 BrowserMainRunnerImpl() |
121 : initialization_started_(false), is_shutdown_(false) {} | 123 : initialization_started_(false), is_shutdown_(false) {} |
122 | 124 |
123 ~BrowserMainRunnerImpl() override { | 125 ~BrowserMainRunnerImpl() override { |
124 if (initialization_started_ && !is_shutdown_) | 126 if (initialization_started_ && !is_shutdown_) |
125 Shutdown(); | 127 Shutdown(); |
126 } | 128 } |
127 | 129 |
128 int Initialize(const MainFunctionParams& parameters) override { | 130 int Initialize(const MainFunctionParams& parameters) override { |
| 131 // TODO(vadimt): Remove all tracked_objects references below once |
| 132 // crbug.com/453640 is fixed. |
| 133 tracked_objects::ThreadData::InitializeThreadContext("CrBrowserMain"); |
| 134 |
| 135 tracked_objects::ScopedTracker tracking_profile( |
| 136 FROM_HERE_WITH_EXPLICIT_FUNCTION("BrowserMainRunnerImpl::Initialize")); |
| 137 |
129 TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize"); | 138 TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize"); |
130 // On Android we normally initialize the browser in a series of UI thread | 139 // On Android we normally initialize the browser in a series of UI thread |
131 // tasks. While this is happening a second request can come from the OS or | 140 // tasks. While this is happening a second request can come from the OS or |
132 // another application to start the browser. If this happens then we must | 141 // another application to start the browser. If this happens then we must |
133 // not run these parts of initialization twice. | 142 // not run these parts of initialization twice. |
134 if (!initialization_started_) { | 143 if (!initialization_started_) { |
135 initialization_started_ = true; | 144 initialization_started_ = true; |
136 | 145 |
137 #if !defined(OS_IOS) | 146 #if !defined(OS_IOS) |
138 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) | 147 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 286 |
278 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); | 287 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); |
279 }; | 288 }; |
280 | 289 |
281 // static | 290 // static |
282 BrowserMainRunner* BrowserMainRunner::Create() { | 291 BrowserMainRunner* BrowserMainRunner::Create() { |
283 return new BrowserMainRunnerImpl(); | 292 return new BrowserMainRunnerImpl(); |
284 } | 293 } |
285 | 294 |
286 } // namespace content | 295 } // namespace content |
OLD | NEW |