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

Side by Side Diff: webkit/media/buffered_data_source.cc

Issue 9854031: Replace size_t with int in a few media classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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 | « webkit/media/buffered_data_source.h ('k') | webkit/media/buffered_data_source_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 "webkit/media/buffered_data_source.h" 5 #include "webkit/media/buffered_data_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "media/base/media_log.h" 8 #include "media/base/media_log.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 void BufferedDataSource::SetBitrate(int bitrate) { 134 void BufferedDataSource::SetBitrate(int bitrate) {
135 render_loop_->PostTask(FROM_HERE, base::Bind( 135 render_loop_->PostTask(FROM_HERE, base::Bind(
136 &BufferedDataSource::SetBitrateTask, this, bitrate)); 136 &BufferedDataSource::SetBitrateTask, this, bitrate));
137 } 137 }
138 138
139 ///////////////////////////////////////////////////////////////////////////// 139 /////////////////////////////////////////////////////////////////////////////
140 // media::DataSource implementation. 140 // media::DataSource implementation.
141 void BufferedDataSource::Read( 141 void BufferedDataSource::Read(
142 int64 position, size_t size, uint8* data, 142 int64 position, int size, uint8* data,
143 const media::DataSource::ReadCB& read_cb) { 143 const media::DataSource::ReadCB& read_cb) {
144 DVLOG(1) << "Read: " << position << " offset, " << size << " bytes"; 144 DVLOG(1) << "Read: " << position << " offset, " << size << " bytes";
145 DCHECK(!read_cb.is_null()); 145 DCHECK(!read_cb.is_null());
146 146
147 { 147 {
148 base::AutoLock auto_lock(lock_); 148 base::AutoLock auto_lock(lock_);
149 DCHECK(read_cb_.is_null()); 149 DCHECK(read_cb_.is_null());
150 150
151 if (stop_signal_received_ || stopped_on_render_loop_) { 151 if (stop_signal_received_ || stopped_on_render_loop_) {
152 read_cb.Run(kReadError); 152 read_cb.Run(kReadError);
153 return; 153 return;
154 } 154 }
155 155
156 read_cb_ = read_cb; 156 read_cb_ = read_cb;
157 } 157 }
158 158
159 render_loop_->PostTask(FROM_HERE, base::Bind( 159 render_loop_->PostTask(FROM_HERE, base::Bind(
160 &BufferedDataSource::ReadTask, this, 160 &BufferedDataSource::ReadTask, this, position, size, data));
161 position, static_cast<int>(size), data));
162 } 161 }
163 162
164 bool BufferedDataSource::GetSize(int64* size_out) { 163 bool BufferedDataSource::GetSize(int64* size_out) {
165 if (total_bytes_ != kPositionNotSpecified) { 164 if (total_bytes_ != kPositionNotSpecified) {
166 *size_out = total_bytes_; 165 *size_out = total_bytes_;
167 return true; 166 return true;
168 } 167 }
169 *size_out = 0; 168 *size_out = 0;
170 return false; 169 return false;
171 } 170 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // Method to report the results of the current read request. Also reset all 326 // Method to report the results of the current read request. Also reset all
328 // the read parameters. 327 // the read parameters.
329 void BufferedDataSource::DoneRead_Locked(int error) { 328 void BufferedDataSource::DoneRead_Locked(int error) {
330 DVLOG(1) << "DoneRead: " << error << " bytes"; 329 DVLOG(1) << "DoneRead: " << error << " bytes";
331 330
332 DCHECK(MessageLoop::current() == render_loop_); 331 DCHECK(MessageLoop::current() == render_loop_);
333 DCHECK(!read_cb_.is_null()); 332 DCHECK(!read_cb_.is_null());
334 lock_.AssertAcquired(); 333 lock_.AssertAcquired();
335 334
336 if (error >= 0) { 335 if (error >= 0) {
337 read_cb_.Run(static_cast<size_t>(error)); 336 read_cb_.Run(error);
338 } else { 337 } else {
339 read_cb_.Run(kReadError); 338 read_cb_.Run(kReadError);
340 } 339 }
341 340
342 read_cb_.Reset(); 341 read_cb_.Reset();
343 read_position_ = 0; 342 read_position_ = 0;
344 read_size_ = 0; 343 read_size_ = 0;
345 read_buffer_ = 0; 344 read_buffer_ = 0;
346 } 345 }
347 346
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 586
588 if (!host()) 587 if (!host())
589 return; 588 return;
590 589
591 if (total_bytes_ != kPositionNotSpecified) 590 if (total_bytes_ != kPositionNotSpecified)
592 host()->SetTotalBytes(total_bytes_); 591 host()->SetTotalBytes(total_bytes_);
593 host()->SetBufferedBytes(buffered_bytes_); 592 host()->SetBufferedBytes(buffered_bytes_);
594 } 593 }
595 594
596 } // namespace webkit_media 595 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/buffered_data_source.h ('k') | webkit/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698