OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/cast_browser_main_parts.h" | 5 #include "chromecast/browser/cast_browser_main_parts.h" |
6 | 6 |
7 #if !defined(OS_ANDROID) | 7 #if !defined(OS_ANDROID) |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <sys/prctl.h> | 9 #include <sys/prctl.h> |
10 #endif | 10 #endif |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 NOTREACHED(); | 133 NOTREACHED(); |
134 } else { | 134 } else { |
135 DCHECK_EQ(sa_old.sa_handler, KillOnAlarm); | 135 DCHECK_EQ(sa_old.sa_handler, KillOnAlarm); |
136 } | 136 } |
137 } | 137 } |
138 #endif // !defined(OS_ANDROID) | 138 #endif // !defined(OS_ANDROID) |
139 | 139 |
140 } // namespace | 140 } // namespace |
141 | 141 |
142 namespace chromecast { | 142 namespace chromecast { |
143 | |
144 namespace media { | |
145 // Forward declaration of setter for audio manager factory. This method should | |
146 // call ::media::AudioManager::SetAudioManagerFactory to provide a platform | |
147 // implmentation of AudioManager. | |
148 void SetPlatformAudioManagerFactory(); | |
gunsch
2015/04/30 15:50:38
This interface probably lives better somewhere lik
| |
149 } | |
150 | |
143 namespace shell { | 151 namespace shell { |
144 | 152 |
145 namespace { | 153 namespace { |
146 | 154 |
147 struct DefaultCommandLineSwitch { | 155 struct DefaultCommandLineSwitch { |
148 const char* const switch_name; | 156 const char* const switch_name; |
149 const char* const switch_value; | 157 const char* const switch_value; |
150 }; | 158 }; |
151 | 159 |
152 DefaultCommandLineSwitch g_default_switches[] = { | 160 DefaultCommandLineSwitch g_default_switches[] = { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 } | 213 } |
206 | 214 |
207 void CastBrowserMainParts::PreMainMessageLoopStart() { | 215 void CastBrowserMainParts::PreMainMessageLoopStart() { |
208 // GroupedHistograms needs to be initialized before any threads are created | 216 // GroupedHistograms needs to be initialized before any threads are created |
209 // to prevent race conditions between calls to Preregister and those threads | 217 // to prevent race conditions between calls to Preregister and those threads |
210 // attempting to collect metrics. | 218 // attempting to collect metrics. |
211 // This call must also be before NetworkChangeNotifier, as it generates | 219 // This call must also be before NetworkChangeNotifier, as it generates |
212 // Net/DNS metrics. | 220 // Net/DNS metrics. |
213 metrics::PreregisterAllGroupedHistograms(); | 221 metrics::PreregisterAllGroupedHistograms(); |
214 | 222 |
223 // Set the platform's implementation of AudioManager factory. | |
224 ::chromecast::media::SetPlatformAudioManagerFactory(); | |
225 | |
215 #if defined(OS_ANDROID) | 226 #if defined(OS_ANDROID) |
216 net::NetworkChangeNotifier::SetFactory( | 227 net::NetworkChangeNotifier::SetFactory( |
217 new net::NetworkChangeNotifierFactoryAndroid()); | 228 new net::NetworkChangeNotifierFactoryAndroid()); |
218 #endif // defined(OS_ANDROID) | 229 #endif // defined(OS_ANDROID) |
219 } | 230 } |
220 | 231 |
221 void CastBrowserMainParts::PostMainMessageLoopStart() { | 232 void CastBrowserMainParts::PostMainMessageLoopStart() { |
222 cast_browser_process_->SetMetricsHelper(make_scoped_ptr( | 233 cast_browser_process_->SetMetricsHelper(make_scoped_ptr( |
223 new metrics::CastMetricsHelper(base::MessageLoopProxy::current()))); | 234 new metrics::CastMetricsHelper(base::MessageLoopProxy::current()))); |
224 | 235 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 #else | 356 #else |
346 cast_browser_process_->cast_service()->Finalize(); | 357 cast_browser_process_->cast_service()->Finalize(); |
347 cast_browser_process_->metrics_service_client()->Finalize(); | 358 cast_browser_process_->metrics_service_client()->Finalize(); |
348 cast_browser_process_.reset(); | 359 cast_browser_process_.reset(); |
349 DeregisterKillOnAlarm(); | 360 DeregisterKillOnAlarm(); |
350 #endif | 361 #endif |
351 } | 362 } |
352 | 363 |
353 } // namespace shell | 364 } // namespace shell |
354 } // namespace chromecast | 365 } // namespace chromecast |
OLD | NEW |