Chromium Code Reviews| 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" | 7 #include "base/allocator/allocator_shim.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/metrics/statistics_recorder.h" | 13 #include "base/metrics/statistics_recorder.h" |
| 14 #include "content/browser/browser_main_loop.h" | 14 #include "content/browser/browser_main_loop.h" |
| 15 #include "content/browser/notification_service_impl.h" | 15 #include "content/browser/notification_service_impl.h" |
| 16 #include "content/common/child_process.h" | 16 #include "content/common/child_process.h" |
| 17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 19 #include "content/public/common/main_function_params.h" | 19 #include "content/public/common/main_function_params.h" |
| 20 | 20 |
| 21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 22 #include "base/win/scoped_com_initializer.h" | 22 #include "base/win/scoped_com_initializer.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if defined(OS_ANDROID) | |
| 26 #include "content/browser/android/surface_texture_peer_browser_impl.h" | |
| 27 #endif | |
| 28 | |
| 25 bool g_exited_main_message_loop = false; | 29 bool g_exited_main_message_loop = false; |
| 26 | 30 |
| 27 namespace { | 31 namespace { |
| 28 | 32 |
| 29 class BrowserMainRunnerImpl : public content::BrowserMainRunner { | 33 class BrowserMainRunnerImpl : public content::BrowserMainRunner { |
| 30 public: | 34 public: |
| 31 BrowserMainRunnerImpl() | 35 BrowserMainRunnerImpl() |
| 32 : is_initialized_(false), | 36 : is_initialized_(false), |
| 33 is_shutdown_(false), | 37 is_shutdown_(false), |
| 34 created_threads_(false) { | 38 created_threads_(false) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic | 80 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic |
| 77 // allocator selection is not supported. | 81 // allocator selection is not supported. |
| 78 | 82 |
| 79 // Make this call before going multithreaded, or spawning any subprocesses. | 83 // Make this call before going multithreaded, or spawning any subprocesses. |
| 80 base::allocator::SetupSubprocessAllocator(); | 84 base::allocator::SetupSubprocessAllocator(); |
| 81 #endif | 85 #endif |
| 82 | 86 |
| 83 com_initializer_.reset(new base::win::ScopedCOMInitializer); | 87 com_initializer_.reset(new base::win::ScopedCOMInitializer); |
| 84 #endif // OS_WIN | 88 #endif // OS_WIN |
| 85 | 89 |
| 90 #if defined(OS_ANDROID) | |
| 91 content::SurfaceTexturePeer::InitInstance( | |
|
Yaron
2012/09/05 07:03:56
Couldn't this move into ChromeBrowserMainPartsAndr
qinmin
2012/09/05 19:34:42
SurfaceTexturePeerBrowserImpl is not under content
| |
| 92 new content::SurfaceTexturePeerBrowserImpl( | |
| 93 parameters.command_line.HasSwitch( | |
| 94 switches::kMediaPlayerInRenderProcess))); | |
| 95 #endif | |
| 96 | |
| 86 main_loop_->CreateThreads(); | 97 main_loop_->CreateThreads(); |
| 87 int result_code = main_loop_->GetResultCode(); | 98 int result_code = main_loop_->GetResultCode(); |
| 88 if (result_code > 0) | 99 if (result_code > 0) |
| 89 return result_code; | 100 return result_code; |
| 90 created_threads_ = true; | 101 created_threads_ = true; |
| 91 | 102 |
| 92 // Return -1 to indicate no early termination. | 103 // Return -1 to indicate no early termination. |
| 93 return -1; | 104 return -1; |
| 94 } | 105 } |
| 95 | 106 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 } // namespace | 152 } // namespace |
| 142 | 153 |
| 143 namespace content { | 154 namespace content { |
| 144 | 155 |
| 145 // static | 156 // static |
| 146 BrowserMainRunner* BrowserMainRunner::Create() { | 157 BrowserMainRunner* BrowserMainRunner::Create() { |
| 147 return new BrowserMainRunnerImpl(); | 158 return new BrowserMainRunnerImpl(); |
| 148 } | 159 } |
| 149 | 160 |
| 150 } // namespace content | 161 } // namespace content |
| OLD | NEW |