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

Side by Side Diff: webkit/glue/media/simple_data_source.cc

Issue 155230: Made MediaFilter::host_ and MediaFilter::message_loop_ private. (Closed)
Patch Set: Merge with ToT Created 11 years, 5 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 | « media/filters/video_renderer_base.cc ('k') | no next file » | 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. 1 // Copyright (c) 2009 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/process_util.h" 6 #include "base/process_util.h"
7 #include "media/base/filter_host.h" 7 #include "media/base/filter_host.h"
8 #include "net/base/load_flags.h" 8 #include "net/base/load_flags.h"
9 #include "net/http/http_response_headers.h" 9 #include "net/http/http_response_headers.h"
10 #include "net/url_request/url_request_status.h" 10 #include "net/url_request/url_request_status.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 bool SimpleDataSource::Initialize(const std::string& url) { 58 bool SimpleDataSource::Initialize(const std::string& url) {
59 AutoLock auto_lock(lock_); 59 AutoLock auto_lock(lock_);
60 DCHECK_EQ(state_, UNINITIALIZED); 60 DCHECK_EQ(state_, UNINITIALIZED);
61 state_ = INITIALIZING; 61 state_ = INITIALIZING;
62 62
63 // Validate the URL. 63 // Validate the URL.
64 SetURL(GURL(url)); 64 SetURL(GURL(url));
65 if (!url_.is_valid() || !IsSchemeSupported(url_)) { 65 if (!url_.is_valid() || !IsSchemeSupported(url_)) {
66 host_->Error(media::PIPELINE_ERROR_NETWORK); 66 host()->Error(media::PIPELINE_ERROR_NETWORK);
67 return false; 67 return false;
68 } 68 }
69 69
70 // Post a task to the render thread to start loading the resource. 70 // Post a task to the render thread to start loading the resource.
71 render_loop_->PostTask(FROM_HERE, 71 render_loop_->PostTask(FROM_HERE,
72 NewRunnableMethod(this, &SimpleDataSource::StartTask)); 72 NewRunnableMethod(this, &SimpleDataSource::StartTask));
73 return true; 73 return true;
74 } 74 }
75 75
76 const media::MediaFormat& SimpleDataSource::media_format() { 76 const media::MediaFormat& SimpleDataSource::media_format() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 DCHECK(bridge_.get()); 138 DCHECK(bridge_.get());
139 bridge_.reset(); 139 bridge_.reset();
140 140
141 // If we don't get a content length or the request has failed, report it 141 // If we don't get a content length or the request has failed, report it
142 // as a network error. 142 // as a network error.
143 DCHECK(size_ == -1 || size_ == data_.length()); 143 DCHECK(size_ == -1 || size_ == data_.length());
144 if (size_ == -1) { 144 if (size_ == -1) {
145 size_ = data_.length(); 145 size_ = data_.length();
146 } 146 }
147 if (!status.is_success()) { 147 if (!status.is_success()) {
148 host_->Error(media::PIPELINE_ERROR_NETWORK); 148 host()->Error(media::PIPELINE_ERROR_NETWORK);
149 return; 149 return;
150 } 150 }
151 151
152 // We're initialized! 152 // We're initialized!
153 state_ = INITIALIZED; 153 state_ = INITIALIZED;
154 host_->SetTotalBytes(size_); 154 host()->SetTotalBytes(size_);
155 host_->SetBufferedBytes(size_); 155 host()->SetBufferedBytes(size_);
156 host_->InitializationComplete(); 156 host()->InitializationComplete();
157 } 157 }
158 158
159 std::string SimpleDataSource::GetURLForDebugging() { 159 std::string SimpleDataSource::GetURLForDebugging() {
160 return url_.spec(); 160 return url_.spec();
161 } 161 }
162 162
163 void SimpleDataSource::SetURL(const GURL& url) { 163 void SimpleDataSource::SetURL(const GURL& url) {
164 url_ = url; 164 url_ = url;
165 media_format_.Clear(); 165 media_format_.Clear();
166 media_format_.SetAsString(media::MediaFormat::kMimeType, 166 media_format_.SetAsString(media::MediaFormat::kMimeType,
(...skipping 22 matching lines...) Expand all
189 DCHECK_EQ(state_, STOPPED); 189 DCHECK_EQ(state_, STOPPED);
190 190
191 // Cancel any pending requests. 191 // Cancel any pending requests.
192 if (bridge_.get()) { 192 if (bridge_.get()) {
193 bridge_->Cancel(); 193 bridge_->Cancel();
194 bridge_.reset(); 194 bridge_.reset();
195 } 195 }
196 } 196 }
197 197
198 } // namespace webkit_glue 198 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698