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

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: todo 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
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_unittest.cc » ('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/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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 PipelineStatistics Pipeline::GetStatistics() const { 254 PipelineStatistics Pipeline::GetStatistics() const {
255 base::AutoLock auto_lock(lock_); 255 base::AutoLock auto_lock(lock_);
256 return statistics_; 256 return statistics_;
257 } 257 }
258 258
259 void Pipeline::SetClockForTesting(Clock* clock) { 259 void Pipeline::SetClockForTesting(Clock* clock) {
260 clock_.reset(clock); 260 clock_.reset(clock);
261 } 261 }
262 262
263 void Pipeline::SetErrorForTesting(PipelineStatus status) {
264 SetError(status);
265 }
266
263 void Pipeline::SetState(State next_state) { 267 void Pipeline::SetState(State next_state) {
264 if (state_ != kStarted && next_state == kStarted && 268 if (state_ != kStarted && next_state == kStarted &&
265 !creation_time_.is_null()) { 269 !creation_time_.is_null()) {
266 UMA_HISTOGRAM_TIMES( 270 UMA_HISTOGRAM_TIMES(
267 "Media.TimeToPipelineStarted", base::Time::Now() - creation_time_); 271 "Media.TimeToPipelineStarted", base::Time::Now() - creation_time_);
268 creation_time_ = base::Time(); 272 creation_time_ = base::Time();
269 } 273 }
270 state_ = next_state; 274 state_ = next_state;
271 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state)); 275 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state));
272 } 276 }
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 1299 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
1296 lock_.AssertAcquired(); 1300 lock_.AssertAcquired();
1297 if (!waiting_for_clock_update_) 1301 if (!waiting_for_clock_update_)
1298 return; 1302 return;
1299 1303
1300 waiting_for_clock_update_ = false; 1304 waiting_for_clock_update_ = false;
1301 clock_->Play(); 1305 clock_->Play();
1302 } 1306 }
1303 1307
1304 } // namespace media 1308 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698