Index: Source/modules/presentation/PresentationSession.h |
diff --git a/Source/modules/presentation/PresentationSession.h b/Source/modules/presentation/PresentationSession.h |
index 378995d434d77e45b804057c0fda35fbafcf9afd..3511a571b06b4448ec6985296efdfac6f89048cb 100644 |
--- a/Source/modules/presentation/PresentationSession.h |
+++ b/Source/modules/presentation/PresentationSession.h |
@@ -6,6 +6,8 @@ |
#define PresentationSession_h |
#include "core/events/EventTarget.h" |
+#include "core/fileapi/Blob.h" |
+#include "core/fileapi/FileError.h" |
#include "core/frame/DOMWindowProperty.h" |
#include "public/platform/modules/presentation/WebPresentationSessionClient.h" |
#include "wtf/text/WTFString.h" |
@@ -44,6 +46,7 @@ public: |
void send(const String& message, ExceptionState&); |
void send(PassRefPtr<DOMArrayBuffer> data, ExceptionState&); |
void send(PassRefPtr<DOMArrayBufferView> data, ExceptionState&); |
+ void send(Blob* data, ExceptionState&); |
void close(); |
DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
@@ -59,6 +62,21 @@ public: |
void didReceiveTextMessage(const String& message); |
private: |
+ class BlobLoader; |
+ // Blob data items are queued and sent after loading asynchronously. |
+ struct Message { |
+ Message(PassRefPtr<BlobDataHandle> blobDataHandle) |
+ : blobDataHandle(blobDataHandle) |
+ { |
+ } |
+ |
+ RefPtr<BlobDataHandle> blobDataHandle; |
+ // TODO(s.singapati): Currently String and ArrayBuffer data is sent |
mark a. foltz
2015/05/26 20:41:48
It looks like the way that WebSocket implements se
USE s.singapati at gmail.com
2015/05/27 19:37:51
Done. One difference is, this patch does not repla
|
+ // immediately to the client, but Blob data is loaded as array buffer |
+ // asynchrounously and then sent. This makes message sending order |
+ // incorrect. |
+ }; |
+ |
PresentationSession(LocalFrame*, const String& id, const String& url); |
// Returns the |PresentationController| object associated with the frame |
@@ -69,9 +87,19 @@ private: |
// Common send method for both ArrayBufferView and ArrayBuffer. |
void sendInternal(const uint8_t* data, size_t, ExceptionState&); |
+ void handleMessageQueue(); |
+ |
+ // Callbacks invoked from BlobLoader. |
+ void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>); |
+ void didFailLoadingBlob(FileError::ErrorCode); |
+ |
String m_id; |
String m_url; |
WebPresentationSessionState m_state; |
+ |
+ // For Blob data handling. |
+ Member<BlobLoader> m_blobLoader; |
+ Deque<OwnPtr<Message>> m_messages; |
}; |
} // namespace blink |