Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: media/audio/audio_output_controller.cc

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | media/audio/audio_output_dispatcher_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/audio/audio_output_controller.h" 5 #include "media/audio/audio_output_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // to record statistics about the number of wedged playbacks in the field. 169 // to record statistics about the number of wedged playbacks in the field.
170 // 170 //
171 // WedgeCheck() will look to see if |on_more_io_data_called_| is true after 171 // WedgeCheck() will look to see if |on_more_io_data_called_| is true after
172 // the timeout expires. Care must be taken to ensure the wedge check delay is 172 // the timeout expires. Care must be taken to ensure the wedge check delay is
173 // large enough that the value isn't queried while OnMoreDataIO() is setting 173 // large enough that the value isn't queried while OnMoreDataIO() is setting
174 // it. 174 // it.
175 // 175 //
176 // Timer self-manages its lifetime and WedgeCheck() will only record the UMA 176 // Timer self-manages its lifetime and WedgeCheck() will only record the UMA
177 // statistic if state is still kPlaying. Additional Start() calls will 177 // statistic if state is still kPlaying. Additional Start() calls will
178 // invalidate the previous timer. 178 // invalidate the previous timer.
179 wedge_timer_.reset(new base::OneShotTimer<AudioOutputController>()); 179 wedge_timer_.reset(new base::OneShotTimer());
180 wedge_timer_->Start( 180 wedge_timer_->Start(
181 FROM_HERE, TimeDelta::FromSeconds(5), this, 181 FROM_HERE, TimeDelta::FromSeconds(5), this,
182 &AudioOutputController::WedgeCheck); 182 &AudioOutputController::WedgeCheck);
183 183
184 handler_->OnPlaying(); 184 handler_->OnPlaying();
185 } 185 }
186 186
187 void AudioOutputController::StopStream() { 187 void AudioOutputController::StopStream() {
188 DCHECK(message_loop_->BelongsToCurrentThread()); 188 DCHECK(message_loop_->BelongsToCurrentThread());
189 189
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 DCHECK(message_loop_->BelongsToCurrentThread()); 408 DCHECK(message_loop_->BelongsToCurrentThread());
409 409
410 // If we should be playing and we haven't, that's a wedge. 410 // If we should be playing and we haven't, that's a wedge.
411 if (state_ == kPlaying) { 411 if (state_ == kPlaying) {
412 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess", 412 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess",
413 base::AtomicRefCountIsOne(&on_more_io_data_called_)); 413 base::AtomicRefCountIsOne(&on_more_io_data_called_));
414 } 414 }
415 } 415 }
416 416
417 } // namespace media 417 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | media/audio/audio_output_dispatcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698