| 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/metro.h" | 22 #include "base/win/metro.h" |
| 23 #include "base/win/scoped_com_initializer.h" | 23 #include "base/win/scoped_com_initializer.h" |
| 24 #include "ui/base/win/tsf_bridge.h" | 24 #include "ui/base/win/tsf_bridge.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #if defined(OS_ANDROID) |
| 28 #include "content/browser/android/surface_texture_peer_browser_impl.h" |
| 29 #endif |
| 30 |
| 27 bool g_exited_main_message_loop = false; | 31 bool g_exited_main_message_loop = false; |
| 28 | 32 |
| 29 namespace { | 33 namespace { |
| 30 | 34 |
| 31 class BrowserMainRunnerImpl : public content::BrowserMainRunner { | 35 class BrowserMainRunnerImpl : public content::BrowserMainRunner { |
| 32 public: | 36 public: |
| 33 BrowserMainRunnerImpl() | 37 BrowserMainRunnerImpl() |
| 34 : is_initialized_(false), | 38 : is_initialized_(false), |
| 35 is_shutdown_(false), | 39 is_shutdown_(false), |
| 36 created_threads_(false) { | 40 created_threads_(false) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // allocator selection is not supported. | 92 // allocator selection is not supported. |
| 89 | 93 |
| 90 // Make this call before going multithreaded, or spawning any subprocesses. | 94 // Make this call before going multithreaded, or spawning any subprocesses. |
| 91 base::allocator::SetupSubprocessAllocator(); | 95 base::allocator::SetupSubprocessAllocator(); |
| 92 #endif | 96 #endif |
| 93 com_initializer_.reset(new base::win::ScopedCOMInitializer); | 97 com_initializer_.reset(new base::win::ScopedCOMInitializer); |
| 94 if (base::win::IsTsfAwareRequired()) | 98 if (base::win::IsTsfAwareRequired()) |
| 95 ui::TsfBridge::Initialize(); | 99 ui::TsfBridge::Initialize(); |
| 96 #endif // OS_WIN | 100 #endif // OS_WIN |
| 97 | 101 |
| 102 #if defined(OS_ANDROID) |
| 103 content::SurfaceTexturePeer::InitInstance( |
| 104 new content::SurfaceTexturePeerBrowserImpl( |
| 105 parameters.command_line.HasSwitch( |
| 106 switches::kMediaPlayerInRenderProcess))); |
| 107 #endif |
| 108 |
| 98 main_loop_->CreateThreads(); | 109 main_loop_->CreateThreads(); |
| 99 int result_code = main_loop_->GetResultCode(); | 110 int result_code = main_loop_->GetResultCode(); |
| 100 if (result_code > 0) | 111 if (result_code > 0) |
| 101 return result_code; | 112 return result_code; |
| 102 created_threads_ = true; | 113 created_threads_ = true; |
| 103 | 114 |
| 104 // Return -1 to indicate no early termination. | 115 // Return -1 to indicate no early termination. |
| 105 return -1; | 116 return -1; |
| 106 } | 117 } |
| 107 | 118 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } // namespace | 166 } // namespace |
| 156 | 167 |
| 157 namespace content { | 168 namespace content { |
| 158 | 169 |
| 159 // static | 170 // static |
| 160 BrowserMainRunner* BrowserMainRunner::Create() { | 171 BrowserMainRunner* BrowserMainRunner::Create() { |
| 161 return new BrowserMainRunnerImpl(); | 172 return new BrowserMainRunnerImpl(); |
| 162 } | 173 } |
| 163 | 174 |
| 164 } // namespace content | 175 } // namespace content |
| OLD | NEW |