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

Unified Diff: webkit/glue/media/simple_data_source.cc

Issue 155608: Adding callback support to media filter Initialize() and Seek(). (Closed)
Patch Set: Full patch 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/media/simple_data_source.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/media/simple_data_source.cc
diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc
index 2f49e67a2e4ca2aae8464049b8fc1ae65c487c75..afa27fff51073ca1b3b964f2cadf2e9fe63d3302 100644
--- a/webkit/glue/media/simple_data_source.cc
+++ b/webkit/glue/media/simple_data_source.cc
@@ -55,22 +55,26 @@ void SimpleDataSource::Stop() {
NewRunnableMethod(this, &SimpleDataSource::CancelTask));
}
-bool SimpleDataSource::Initialize(const std::string& url) {
+void SimpleDataSource::Initialize(const std::string& url,
+ media::FilterCallback* callback) {
AutoLock auto_lock(lock_);
DCHECK_EQ(state_, UNINITIALIZED);
+ DCHECK(callback);
state_ = INITIALIZING;
+ initialize_callback_.reset(callback);
// Validate the URL.
SetURL(GURL(url));
if (!url_.is_valid() || !IsSchemeSupported(url_)) {
host()->Error(media::PIPELINE_ERROR_NETWORK);
- return false;
+ initialize_callback_->Run();
+ initialize_callback_.reset();
+ return;
}
// Post a task to the render thread to start loading the resource.
render_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &SimpleDataSource::StartTask));
- return true;
}
const media::MediaFormat& SimpleDataSource::media_format() {
@@ -144,16 +148,17 @@ void SimpleDataSource::OnCompletedRequest(const URLRequestStatus& status,
if (size_ == -1) {
size_ = data_.length();
}
- if (!status.is_success()) {
- host()->Error(media::PIPELINE_ERROR_NETWORK);
- return;
- }
// We're initialized!
- state_ = INITIALIZED;
- host()->SetTotalBytes(size_);
- host()->SetBufferedBytes(size_);
- host()->InitializationComplete();
+ if (status.is_success()) {
+ state_ = INITIALIZED;
+ host()->SetTotalBytes(size_);
+ host()->SetBufferedBytes(size_);
+ } else {
+ host()->Error(media::PIPELINE_ERROR_NETWORK);
+ }
+ initialize_callback_->Run();
+ initialize_callback_.reset();
}
std::string SimpleDataSource::GetURLForDebugging() {
« no previous file with comments | « webkit/glue/media/simple_data_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698