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

Side by Side Diff: media/base/pipeline.cc

Issue 10832197: Add a lot of Pipeline tests to cover stopping/error handling while in a variety of states. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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/base/pipeline.h" 5 #include "media/base/pipeline.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 PipelineStatistics Pipeline::GetStatistics() const { 253 PipelineStatistics Pipeline::GetStatistics() const {
254 base::AutoLock auto_lock(lock_); 254 base::AutoLock auto_lock(lock_);
255 return statistics_; 255 return statistics_;
256 } 256 }
257 257
258 void Pipeline::SetClockForTesting(Clock* clock) { 258 void Pipeline::SetClockForTesting(Clock* clock) {
259 clock_.reset(clock); 259 clock_.reset(clock);
260 } 260 }
261 261
262 void Pipeline::SetErrorForTesting(PipelineStatus status) {
263 SetError(status);
264 }
265
262 void Pipeline::SetState(State next_state) { 266 void Pipeline::SetState(State next_state) {
263 if (state_ != kStarted && next_state == kStarted && 267 if (state_ != kStarted && next_state == kStarted &&
264 !creation_time_.is_null()) { 268 !creation_time_.is_null()) {
265 UMA_HISTOGRAM_TIMES( 269 UMA_HISTOGRAM_TIMES(
266 "Media.TimeToPipelineStarted", base::Time::Now() - creation_time_); 270 "Media.TimeToPipelineStarted", base::Time::Now() - creation_time_);
267 creation_time_ = base::Time(); 271 creation_time_ = base::Time();
268 } 272 }
269 state_ = next_state; 273 state_ = next_state;
270 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state)); 274 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state));
271 } 275 }
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 1279 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
1276 lock_.AssertAcquired(); 1280 lock_.AssertAcquired();
1277 if (!waiting_for_clock_update_) 1281 if (!waiting_for_clock_update_)
1278 return; 1282 return;
1279 1283
1280 waiting_for_clock_update_ = false; 1284 waiting_for_clock_update_ = false;
1281 clock_->Play(); 1285 clock_->Play();
1282 } 1286 }
1283 1287
1284 } // namespace media 1288 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698