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

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

Issue 16823003: Replace erroneous use of base::Time with base::TimeTicks throughout media code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/PresubmitPromptWarning/PresubmitPromptOrNotify/ Created 7 years, 6 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 21 matching lines...) Expand all
32 Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, 32 Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
33 MediaLog* media_log) 33 MediaLog* media_log)
34 : message_loop_(message_loop), 34 : message_loop_(message_loop),
35 media_log_(media_log), 35 media_log_(media_log),
36 running_(false), 36 running_(false),
37 did_loading_progress_(false), 37 did_loading_progress_(false),
38 total_bytes_(0), 38 total_bytes_(0),
39 natural_size_(0, 0), 39 natural_size_(0, 0),
40 volume_(1.0f), 40 volume_(1.0f),
41 playback_rate_(0.0f), 41 playback_rate_(0.0f),
42 clock_(new Clock(&default_clock_)), 42 clock_(new Clock(&default_tick_clock_)),
43 waiting_for_clock_update_(false), 43 waiting_for_clock_update_(false),
44 status_(PIPELINE_OK), 44 status_(PIPELINE_OK),
45 has_audio_(false), 45 has_audio_(false),
46 has_video_(false), 46 has_video_(false),
47 state_(kCreated), 47 state_(kCreated),
48 audio_ended_(false), 48 audio_ended_(false),
49 video_ended_(false), 49 video_ended_(false),
50 audio_disabled_(false), 50 audio_disabled_(false),
51 demuxer_(NULL), 51 demuxer_(NULL),
52 creation_time_(base::Time::Now()) { 52 creation_time_(default_tick_clock_.NowTicks()) {
53 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated)); 53 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated));
54 media_log_->AddEvent( 54 media_log_->AddEvent(
55 media_log_->CreateEvent(MediaLogEvent::PIPELINE_CREATED)); 55 media_log_->CreateEvent(MediaLogEvent::PIPELINE_CREATED));
56 } 56 }
57 57
58 Pipeline::~Pipeline() { 58 Pipeline::~Pipeline() {
59 DCHECK(thread_checker_.CalledOnValidThread()) 59 DCHECK(thread_checker_.CalledOnValidThread())
60 << "Pipeline must be destroyed on same thread that created it"; 60 << "Pipeline must be destroyed on same thread that created it";
61 DCHECK(!running_) << "Stop() must complete before destroying object"; 61 DCHECK(!running_) << "Stop() must complete before destroying object";
62 DCHECK(stop_cb_.is_null()); 62 DCHECK(stop_cb_.is_null());
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 clock_.reset(clock); 206 clock_.reset(clock);
207 } 207 }
208 208
209 void Pipeline::SetErrorForTesting(PipelineStatus status) { 209 void Pipeline::SetErrorForTesting(PipelineStatus status) {
210 SetError(status); 210 SetError(status);
211 } 211 }
212 212
213 void Pipeline::SetState(State next_state) { 213 void Pipeline::SetState(State next_state) {
214 if (state_ != kStarted && next_state == kStarted && 214 if (state_ != kStarted && next_state == kStarted &&
215 !creation_time_.is_null()) { 215 !creation_time_.is_null()) {
216 UMA_HISTOGRAM_TIMES( 216 UMA_HISTOGRAM_TIMES("Media.TimeToPipelineStarted",
217 "Media.TimeToPipelineStarted", base::Time::Now() - creation_time_); 217 default_tick_clock_.NowTicks() - creation_time_);
218 creation_time_ = base::Time(); 218 creation_time_ = base::TimeTicks();
219 } 219 }
220 220
221 DVLOG(2) << GetStateString(state_) << " -> " << GetStateString(next_state); 221 DVLOG(2) << GetStateString(state_) << " -> " << GetStateString(next_state);
222 222
223 state_ = next_state; 223 state_ = next_state;
224 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state)); 224 media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(next_state));
225 } 225 }
226 226
227 #define RETURN_STRING(state) case state: return #state; 227 #define RETURN_STRING(state) case state: return #state;
228 228
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 938 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
939 lock_.AssertAcquired(); 939 lock_.AssertAcquired();
940 if (!waiting_for_clock_update_) 940 if (!waiting_for_clock_update_)
941 return; 941 return;
942 942
943 waiting_for_clock_update_ = false; 943 waiting_for_clock_update_ = false;
944 clock_->Play(); 944 clock_->Play();
945 } 945 }
946 946
947 } // namespace media 947 } // 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