Index: content/renderer/presentation/presentation_dispatcher.h |
diff --git a/content/renderer/presentation/presentation_dispatcher.h b/content/renderer/presentation/presentation_dispatcher.h |
index 388adb5f3427e56124399e5b1b2a3f009943953d..db0f6870f611ef3ee537cbd30404f96d64454793 100644 |
--- a/content/renderer/presentation/presentation_dispatcher.h |
+++ b/content/renderer/presentation/presentation_dispatcher.h |
@@ -49,6 +49,9 @@ class CONTENT_EXPORT PresentationDispatcher |
~PresentationDispatcher() override; |
private: |
+ // TODO(zhaobin): remove friend class after moving message queue logic |
+ // from PresentationDispatcher to PresentationConnectionProxy. |
mark a. foltz
2017/01/23 20:18:42
That would be great. Eventually we want to get ri
zhaobin
2017/01/24 01:23:24
Done.
|
+ friend class PresentationConnectionProxy; |
friend class TestPresentationDispatcher; |
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSession); |
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSessionError); |
@@ -65,47 +68,61 @@ class CONTENT_EXPORT PresentationDispatcher |
TestSetDefaultPresentationUrls); |
struct SendMessageRequest { |
- SendMessageRequest(blink::mojom::PresentationSessionInfoPtr session_info, |
- blink::mojom::ConnectionMessagePtr message); |
+ SendMessageRequest( |
+ blink::mojom::PresentationSessionInfoPtr session_info, |
+ blink::mojom::ConnectionMessagePtr message, |
+ const blink::WebPresentationConnectionProxy* connection_proxy); |
~SendMessageRequest(); |
blink::mojom::PresentationSessionInfoPtr session_info; |
blink::mojom::ConnectionMessagePtr message; |
+ // Proxy of blink connection object |connection| calling connection.send(). |
+ // It does not take ownership of proxy object. Proxy object is owned by |
+ // blink connection. Blink connection is destroyed after |
mark a. foltz
2017/01/23 20:18:42
s/blink/Blink/ throughout in comments
zhaobin
2017/01/24 01:23:24
Done.
|
+ // PresentationDispatcher so |connection_proxy| should always be valid. |
+ const blink::WebPresentationConnectionProxy* connection_proxy; |
}; |
static SendMessageRequest* CreateSendTextMessageRequest( |
const blink::WebURL& presentationUrl, |
const blink::WebString& presentationId, |
- const blink::WebString& message); |
+ const blink::WebString& message, |
+ const blink::WebPresentationConnectionProxy* connection_proxy); |
static SendMessageRequest* CreateSendBinaryMessageRequest( |
const blink::WebURL& presentationUrl, |
const blink::WebString& presentationId, |
blink::mojom::PresentationMessageType type, |
const uint8_t* data, |
- size_t length); |
+ size_t length, |
+ const blink::WebPresentationConnectionProxy* connection_proxy); |
// WebPresentationClient implementation. |
void setController(blink::WebPresentationController* controller) override; |
void setReceiver(blink::WebPresentationReceiver*) override; |
- |
void startSession(const blink::WebVector<blink::WebURL>& presentationUrls, |
- std::unique_ptr<blink::WebPresentationConnectionCallback> |
+ std::unique_ptr<blink::WebPresentationConnectionCallbacks> |
callback) override; |
void joinSession(const blink::WebVector<blink::WebURL>& presentationUrls, |
const blink::WebString& presentationId, |
- std::unique_ptr<blink::WebPresentationConnectionCallback> |
+ std::unique_ptr<blink::WebPresentationConnectionCallbacks> |
callback) override; |
- void sendString(const blink::WebURL& presentationUrl, |
- const blink::WebString& presentationId, |
- const blink::WebString& message) override; |
- void sendArrayBuffer(const blink::WebURL& presentationUrl, |
- const blink::WebString& presentationId, |
- const uint8_t* data, |
- size_t length) override; |
- void sendBlobData(const blink::WebURL& presentationUrl, |
- const blink::WebString& presentationId, |
- const uint8_t* data, |
- size_t length) override; |
+ void sendString( |
+ const blink::WebURL& presentationUrl, |
+ const blink::WebString& presentationId, |
+ const blink::WebString& message, |
+ const blink::WebPresentationConnectionProxy* connection_proxy) override; |
+ void sendArrayBuffer( |
+ const blink::WebURL& presentationUrl, |
+ const blink::WebString& presentationId, |
+ const uint8_t* data, |
+ size_t length, |
+ const blink::WebPresentationConnectionProxy* connection_proxy) override; |
+ void sendBlobData( |
+ const blink::WebURL& presentationUrl, |
+ const blink::WebString& presentationId, |
+ const uint8_t* data, |
+ size_t length, |
+ const blink::WebPresentationConnectionProxy* connection_proxy) override; |
void closeSession(const blink::WebURL& presentationUrl, |
const blink::WebString& presentationId) override; |
void terminateSession(const blink::WebURL& presentationUrl, |
@@ -142,7 +159,7 @@ class CONTENT_EXPORT PresentationDispatcher |
blink::mojom::PresentationSessionInfoPtr session_info) override; |
void OnSessionCreated( |
- std::unique_ptr<blink::WebPresentationConnectionCallback> callback, |
+ std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback, |
blink::mojom::PresentationSessionInfoPtr session_info, |
blink::mojom::PresentationErrorPtr error); |
void OnReceiverConnectionAvailable( |