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

Unified Diff: Source/modules/mediastream/RTCDataChannel.h

Issue 268923002: Add support of sending blob data for RTCDataChannel Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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: Source/modules/mediastream/RTCDataChannel.h
diff --git a/Source/modules/mediastream/RTCDataChannel.h b/Source/modules/mediastream/RTCDataChannel.h
index f9a85b0ee98dad49ddd54d5dfff28254d5e34145..f9bfdfc0143d5989a5be4071ccb08b9a59509660 100644
--- a/Source/modules/mediastream/RTCDataChannel.h
+++ b/Source/modules/mediastream/RTCDataChannel.h
@@ -27,10 +27,13 @@
#include "bindings/v8/ScriptWrappable.h"
#include "core/events/EventTarget.h"
+#include "core/fileapi/FileError.h"
+#include "core/fileapi/FileReaderLoaderClient.h"
#include "platform/Timer.h"
#include "platform/heap/Handle.h"
#include "public/platform/WebRTCDataChannelHandler.h"
#include "public/platform/WebRTCDataChannelHandlerClient.h"
+#include "wtf/Deque.h"
#include "wtf/RefCounted.h"
namespace blink {
@@ -42,9 +45,11 @@ struct WebRTCDataChannelInit;
namespace WebCore {
class Blob;
+class BlobDataHandle;
class ExceptionState;
+class FileReaderLoader;
-class RTCDataChannel FINAL : public RefCounted<RTCDataChannel>, public ScriptWrappable, public EventTargetWithInlineData, public blink::WebRTCDataChannelHandlerClient {
+class RTCDataChannel FINAL : public RefCounted<RTCDataChannel>, public ScriptWrappable, public EventTargetWithInlineData, public blink::WebRTCDataChannelHandlerClient, public FileReaderLoaderClient {
REFCOUNTED_EVENT_TARGET(RTCDataChannel);
public:
static PassRefPtr<RTCDataChannel> create(ExecutionContext*, PassOwnPtr<blink::WebRTCDataChannelHandler>);
@@ -86,12 +91,20 @@ public:
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual ExecutionContext* executionContext() const OVERRIDE;
+ // FileReaderLoaderClient functions.
+ virtual void didStartLoading() OVERRIDE;
+ virtual void didReceiveData() OVERRIDE;
+ virtual void didFinishLoading() OVERRIDE;
+ virtual void didFail(FileError::ErrorCode) OVERRIDE;
+
private:
RTCDataChannel(ExecutionContext*, PassOwnPtr<blink::WebRTCDataChannelHandler>);
void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>);
void scheduledEventTimerFired(Timer<RTCDataChannel>*);
+ void processOutgoingBlobQueue();
+
ExecutionContext* m_executionContext;
// blink::WebRTCDataChannelHandlerClient
@@ -112,6 +125,16 @@ private:
};
BinaryType m_binaryType;
+ enum BlobLoaderStatus {
+ BlobLoaderNotStarted,
+ BlobLoaderStarted,
+ BlobLoaderFinished,
+ BlobLoaderFailed
+ };
+ OwnPtr<FileReaderLoader> m_blobLoader;
+ Deque<RefPtr<BlobDataHandle> > m_outgoingBlobQueue;
+ BlobLoaderStatus m_blobLoaderStatus;
+
Timer<RTCDataChannel> m_scheduledEventTimer;
WillBePersistentHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents;
};

Powered by Google App Engine
This is Rietveld 408576698