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

Unified Diff: content/browser/streams/stream.h

Issue 12645004: Add Resource Handler for creating Streams to forward to extensions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make sure things are called on the right thread. Created 7 years, 9 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
Index: content/browser/streams/stream.h
diff --git a/content/browser/streams/stream.h b/content/browser/streams/stream.h
index 3aa389c8d96326868fcdda340d44d85db55f85cc..97d9a3abed3fa8facdb09ae364ede4c0100ed6bb 100644
--- a/content/browser/streams/stream.h
+++ b/content/browser/streams/stream.h
@@ -18,6 +18,8 @@ class IOBuffer;
namespace content {
+class StreamHandle;
+class StreamHandleImpl;
class StreamReadObserver;
class StreamRegistry;
class StreamWriteObserver;
@@ -49,6 +51,9 @@ class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> {
// Removes the read observer. |observer| must be the current observer.
void RemoveReadObserver(StreamReadObserver* observer);
+ // Removes the write observer. |observer| must be the current observer.
+ void RemoveWriteObserver(StreamWriteObserver* observer);
+
// Adds the data in |buffer| to the stream. Takes ownership of |buffer|.
void AddData(scoped_refptr<net::IOBuffer> buffer, size_t size);
@@ -61,6 +66,9 @@ class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> {
// and STREAM_COMPLETE if the stream is finalized and all data has been read.
StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read);
+ scoped_ptr<StreamHandle> CreateHandle();
+ void CloseHandle();
+
// Indicates whether there is space in the buffer to add more data.
bool can_add_data() const { return can_add_data_; }
@@ -92,6 +100,8 @@ class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> {
StreamReadObserver* read_observer_;
StreamWriteObserver* write_observer_;
+ StreamHandleImpl* stream_handle_;
+
base::WeakPtrFactory<Stream> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(Stream);
};

Powered by Google App Engine
This is Rietveld 408576698