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/allocator/allocator_shim.h" | |
8 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 8 #include "base/command_line.h" |
10 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
11 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
12 #include "base/logging.h" | 11 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
14 #include "base/metrics/statistics_recorder.h" | 13 #include "base/metrics/statistics_recorder.h" |
15 #include "content/browser/browser_main_loop.h" | 14 #include "content/browser/browser_main_loop.h" |
16 #include "content/browser/browser_shutdown_profile_dumper.h" | 15 #include "content/browser/browser_shutdown_profile_dumper.h" |
17 #include "content/browser/notification_service_impl.h" | 16 #include "content/browser/notification_service_impl.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Must happen before we try to use a message loop or display any UI. | 176 // Must happen before we try to use a message loop or display any UI. |
178 if (!main_loop_->InitializeToolkit()) | 177 if (!main_loop_->InitializeToolkit()) |
179 return 1; | 178 return 1; |
180 | 179 |
181 main_loop_->MainMessageLoopStart(); | 180 main_loop_->MainMessageLoopStart(); |
182 | 181 |
183 // WARNING: If we get a WM_ENDSESSION, objects created on the stack here | 182 // WARNING: If we get a WM_ENDSESSION, objects created on the stack here |
184 // are NOT deleted. If you need something to run during WM_ENDSESSION add it | 183 // are NOT deleted. If you need something to run during WM_ENDSESSION add it |
185 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. | 184 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. |
186 | 185 |
187 #if defined(OS_WIN) && !defined(NO_TCMALLOC) | |
188 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic | |
189 // allocator selection is not supported. | |
190 | |
191 // Make this call before going multithreaded, or spawning any | |
192 // subprocesses. | |
193 base::allocator::SetupSubprocessAllocator(); | |
194 #endif | |
195 ui::InitializeInputMethod(); | 186 ui::InitializeInputMethod(); |
196 } | 187 } |
197 main_loop_->CreateStartupTasks(); | 188 main_loop_->CreateStartupTasks(); |
198 int result_code = main_loop_->GetResultCode(); | 189 int result_code = main_loop_->GetResultCode(); |
199 if (result_code > 0) | 190 if (result_code > 0) |
200 return result_code; | 191 return result_code; |
201 | 192 |
202 // Return -1 to indicate no early termination. | 193 // Return -1 to indicate no early termination. |
203 return -1; | 194 return -1; |
204 } | 195 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 277 |
287 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); | 278 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); |
288 }; | 279 }; |
289 | 280 |
290 // static | 281 // static |
291 BrowserMainRunner* BrowserMainRunner::Create() { | 282 BrowserMainRunner* BrowserMainRunner::Create() { |
292 return new BrowserMainRunnerImpl(); | 283 return new BrowserMainRunnerImpl(); |
293 } | 284 } |
294 | 285 |
295 } // namespace content | 286 } // namespace content |
OLD | NEW |