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

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

Issue 8936014: Removing DataSource from Filter hierarchy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved preload into a separate file. Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/filter_host.h"
9 #include "media/base/media_log.h" 8 #include "media/base/media_log.h"
10 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
11 #include "webkit/media/web_data_source_factory.h" 10 #include "webkit/media/web_data_source_factory.h"
12 11
13 using WebKit::WebFrame; 12 using WebKit::WebFrame;
14 13
15 namespace webkit_media { 14 namespace webkit_media {
16 15
17 // BufferedDataSource has an intermediate buffer, this value governs the initial 16 // BufferedDataSource has an intermediate buffer, this value governs the initial
18 // size of that buffer. It is set to 32KB because this is a typical read size 17 // size of that buffer. It is set to 32KB because this is a typical read size
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 77
79 return new BufferedResourceLoader(url_, 78 return new BufferedResourceLoader(url_,
80 first_byte_position, 79 first_byte_position,
81 last_byte_position, 80 last_byte_position,
82 ChooseDeferStrategy(), 81 ChooseDeferStrategy(),
83 bitrate_, 82 bitrate_,
84 playback_rate_, 83 playback_rate_,
85 media_log_); 84 media_log_);
86 } 85 }
87 86
88 void BufferedDataSource::set_host(media::FilterHost* host) { 87 void BufferedDataSource::set_host(media::DataSourceHost* host) {
89 DataSource::set_host(host); 88 DataSource::set_host(host);
90 89
91 if (loader_.get()) { 90 if (loader_.get()) {
92 base::AutoLock auto_lock(lock_); 91 base::AutoLock auto_lock(lock_);
93 UpdateHostState_Locked(); 92 UpdateHostState_Locked();
94 } 93 }
95 } 94 }
96 95
97 void BufferedDataSource::Initialize(const std::string& url, 96 void BufferedDataSource::Initialize(const std::string& url,
98 const media::PipelineStatusCB& callback) { 97 const media::PipelineStatusCB& callback) {
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 642
644 buffered_bytes_ = buffered_position + 1; 643 buffered_bytes_ = buffered_position + 1;
645 if (host()) 644 if (host())
646 host()->SetBufferedBytes(buffered_bytes_); 645 host()->SetBufferedBytes(buffered_bytes_);
647 } 646 }
648 647
649 void BufferedDataSource::UpdateHostState_Locked() { 648 void BufferedDataSource::UpdateHostState_Locked() {
650 // Called from various threads, under lock. 649 // Called from various threads, under lock.
651 lock_.AssertAcquired(); 650 lock_.AssertAcquired();
652 651
653 media::FilterHost* filter_host = host(); 652 if (!host())
654 if (!filter_host)
655 return; 653 return;
656 654
657 if (total_bytes_ != kPositionNotSpecified) 655 if (total_bytes_ != kPositionNotSpecified)
658 filter_host->SetTotalBytes(total_bytes_); 656 host()->SetTotalBytes(total_bytes_);
659 filter_host->SetBufferedBytes(buffered_bytes_); 657 host()->SetBufferedBytes(buffered_bytes_);
660 } 658 }
661 659
662 } // namespace webkit_media 660 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698