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

Side by Side Diff: chrome/renderer/media/data_source_impl.cc

Issue 100131: Finished implementing seeking in WebMediaPlayerDelegateImpl. (Closed)
Patch Set: Typo Created 11 years, 7 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 | « no previous file | chrome/renderer/webmediaplayer_delegate_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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/process_util.h" 7 #include "base/process_util.h"
8 #include "chrome/renderer/media/data_source_impl.h" 8 #include "chrome/renderer/media/data_source_impl.h"
9 #include "chrome/renderer/render_view.h" 9 #include "chrome/renderer/render_view.h"
10 #include "chrome/renderer/webmediaplayer_delegate_impl.h" 10 #include "chrome/renderer/webmediaplayer_delegate_impl.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if (size == kuint64max) { 256 if (size == kuint64max) {
257 // If we receive an invalid value for size, we keep on updating the 257 // If we receive an invalid value for size, we keep on updating the
258 // total number of bytes. 258 // total number of bytes.
259 total_bytes_ = position; 259 total_bytes_ = position;
260 } else { 260 } else {
261 total_bytes_ = size; 261 total_bytes_ = size;
262 total_bytes_known_ = true; 262 total_bytes_known_ = true;
263 } 263 }
264 } 264 }
265 } 265 }
266 host_->SetBufferedBytes(downloaded_bytes_);
266 download_event_.Signal(); 267 download_event_.Signal();
267 } 268 }
268 269
269 void DataSourceImpl::OnUploadProgress(uint64 position, uint64 size) { 270 void DataSourceImpl::OnUploadProgress(uint64 position, uint64 size) {
270 // We don't care about upload progress. 271 // We don't care about upload progress.
271 } 272 }
272 273
273 void DataSourceImpl::OnReceivedRedirect(const GURL& new_url) { 274 void DataSourceImpl::OnReceivedRedirect(const GURL& new_url) {
274 // TODO(hclam): what to do here? fire another resource request or show an 275 // TODO(hclam): what to do here? fire another resource request or show an
275 // error? 276 // error?
276 } 277 }
277 278
278 void DataSourceImpl::OnReceivedResponse( 279 void DataSourceImpl::OnReceivedResponse(
279 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, 280 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
280 bool content_filtered) { 281 bool content_filtered) {
281 #if defined(OS_POSIX) 282 #if defined(OS_POSIX)
282 base::PlatformFile response_data_file = info.response_data_file.fd; 283 base::PlatformFile response_data_file = info.response_data_file.fd;
283 #elif defined(OS_WIN) 284 #elif defined(OS_WIN)
284 base::PlatformFile response_data_file = info.response_data_file; 285 base::PlatformFile response_data_file = info.response_data_file;
285 #endif 286 #endif
286 287
287 if (response_data_file != base::kInvalidPlatformFileValue) { 288 if (response_data_file != base::kInvalidPlatformFileValue) {
288 DCHECK(!position_ && !downloaded_bytes_); 289 DCHECK(!position_ && !downloaded_bytes_);
289 if (info.content_length != -1) { 290 if (info.content_length != -1) {
290 total_bytes_known_ = true; 291 total_bytes_known_ = true;
291 total_bytes_ = info.content_length; 292 total_bytes_ = info.content_length;
293 host_->SetTotalBytes(total_bytes_);
292 } 294 }
293 295
294 { 296 {
295 // Post a task to the IO message loop to create the file stream. 297 // Post a task to the IO message loop to create the file stream.
296 // We don't want to post any more tasks once we are stopped. 298 // We don't want to post any more tasks once we are stopped.
297 AutoLock auto_lock(lock_); 299 AutoLock auto_lock(lock_);
298 if (!stopped_) { 300 if (!stopped_) {
299 io_loop_->PostTask(FROM_HERE, 301 io_loop_->PostTask(FROM_HERE,
300 NewRunnableMethod(this, &DataSourceImpl::OnCreateFileStream, 302 NewRunnableMethod(this, &DataSourceImpl::OnCreateFileStream,
301 response_data_file)); 303 response_data_file));
(...skipping 29 matching lines...) Expand all
331 } 333 }
332 } 334 }
333 335
334 std::string DataSourceImpl::GetURLForDebugging() { 336 std::string DataSourceImpl::GetURLForDebugging() {
335 return uri_; 337 return uri_;
336 } 338 }
337 339
338 const media::MediaFormat& DataSourceImpl::media_format() { 340 const media::MediaFormat& DataSourceImpl::media_format() {
339 return media_format_; 341 return media_format_;
340 } 342 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/webmediaplayer_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698