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

Unified Diff: media/filters/blocking_url_protocol.h

Issue 11360237: Use separate WaitableEvents in BlockingUrlProtocol for signalling abort versus read complete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « no previous file | media/filters/blocking_url_protocol.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/blocking_url_protocol.h
diff --git a/media/filters/blocking_url_protocol.h b/media/filters/blocking_url_protocol.h
index dbffbbc3953e6ff92e8a1e909dff37e2609d8590..8eb8ebc50608333e50acd723e3e5466f70728385 100644
--- a/media/filters/blocking_url_protocol.h
+++ b/media/filters/blocking_url_protocol.h
@@ -16,9 +16,6 @@ class DataSource;
// An implementation of FFmpegURLProtocol that blocks until the underlying
// asynchronous DataSource::Read() operation completes.
-//
-// TODO(scherkus): Should be more thread-safe as |last_read_bytes_| is updated
-// from multiple threads without any protection.
class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol {
public:
// Implements FFmpegURLProtocol using the given |data_source|. |error_cb| is
@@ -32,8 +29,6 @@ class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol {
// Aborts any pending reads by returning a read error. After this method
// returns all subsequent calls to Read() will immediately fail.
- //
- // TODO(scherkus): Currently this will cause |error_cb| to fire. Fix.
void Abort();
// FFmpegURLProtocol implementation.
@@ -51,13 +46,9 @@ class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol {
scoped_refptr<DataSource> data_source_;
base::Closure error_cb_;
- // Used to convert an asynchronous DataSource::Read() into a blocking
- // FFmpegUrlProtocol::Read().
- base::WaitableEvent read_event_;
-
- // Read errors and aborts are unrecoverable. Any subsequent reads will
- // immediately fail when this is set to true.
- bool read_has_failed_;
+ // Used to unblock the thread during shutdown and when reads complete.
+ base::WaitableEvent aborted_;
+ base::WaitableEvent read_complete_;
// Cached number of bytes last read from the data source.
int last_read_bytes_;
« no previous file with comments | « no previous file | media/filters/blocking_url_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698