Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PresentationConnection_h | 5 #ifndef PresentationConnection_h |
| 6 #define PresentationConnection_h | 6 #define PresentationConnection_h |
| 7 | 7 |
| 8 #include "core/events/EventTarget.h" | 8 #include "core/events/EventTarget.h" |
| 9 #include "core/fileapi/Blob.h" | 9 #include "core/fileapi/Blob.h" |
| 10 #include "core/fileapi/FileError.h" | 10 #include "core/fileapi/FileError.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 | 70 |
| 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
| 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
| 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate); | 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate); |
| 75 | 75 |
| 76 // Returns true if and only if the WebPresentationConnectionClient represents | 76 // Returns true if and only if the WebPresentationConnectionClient represents |
| 77 // this connection. | 77 // this connection. |
| 78 bool matches(WebPresentationConnectionClient*) const; | 78 bool matches(WebPresentationConnectionClient*) const; |
| 79 | 79 |
| 80 // Notifies the connection about its state change. | 80 // Queue a task to notifies the connection about its state change. |
|
imcheng
2016/10/21 23:58:15
Queues a task to notify...
zhaobin
2016/10/24 19:42:39
reverted.
| |
| 81 void didChangeState(WebPresentationConnectionState); | 81 void didChangeState(WebPresentationConnectionState); |
| 82 | 82 |
| 83 // Notifies the connection about its state change to 'closed'. | 83 // Notifies the connection about its state change to 'closed'. |
| 84 void didClose(WebPresentationConnectionCloseReason, const String& message); | 84 void didClose(WebPresentationConnectionCloseReason, const String& message); |
| 85 | 85 |
| 86 // Notifies the presentation about new message. | 86 // Notifies the presentation about new message. |
| 87 void didReceiveTextMessage(const String& message); | 87 void didReceiveTextMessage(const String& message); |
| 88 void didReceiveBinaryMessage(const uint8_t* data, size_t length); | 88 void didReceiveBinaryMessage(const uint8_t* data, size_t length); |
| 89 | 89 |
| 90 protected: | 90 protected: |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 106 class Message; | 106 class Message; |
| 107 | 107 |
| 108 PresentationConnection(LocalFrame*, const String& id, const KURL&); | 108 PresentationConnection(LocalFrame*, const String& id, const KURL&); |
| 109 | 109 |
| 110 bool canSendMessage(ExceptionState&); | 110 bool canSendMessage(ExceptionState&); |
| 111 void handleMessageQueue(); | 111 void handleMessageQueue(); |
| 112 | 112 |
| 113 // Callbacks invoked from BlobLoader. | 113 // Callbacks invoked from BlobLoader. |
| 114 void didFinishLoadingBlob(DOMArrayBuffer*); | 114 void didFinishLoadingBlob(DOMArrayBuffer*); |
| 115 void didFailLoadingBlob(FileError::ErrorCode); | 115 void didFailLoadingBlob(FileError::ErrorCode); |
| 116 void didChangeStateInternal(WebPresentationConnectionState); | |
|
imcheng
2016/10/21 23:58:15
nit: blank line before this to separate it from th
zhaobin
2016/10/24 19:42:39
reverted.
| |
| 116 | 117 |
| 117 // Cancel loads and pending messages when the connection is closed. | 118 // Cancel loads and pending messages when the connection is closed. |
| 118 void tearDown(); | 119 void tearDown(); |
| 119 | 120 |
| 120 String m_id; | 121 String m_id; |
| 121 KURL m_url; | 122 KURL m_url; |
| 122 WebPresentationConnectionState m_state; | 123 WebPresentationConnectionState m_state; |
| 123 | 124 |
| 124 // For Blob data handling. | 125 // For Blob data handling. |
| 125 Member<BlobLoader> m_blobLoader; | 126 Member<BlobLoader> m_blobLoader; |
| 126 HeapDeque<Member<Message>> m_messages; | 127 HeapDeque<Member<Message>> m_messages; |
| 127 | 128 |
| 128 BinaryType m_binaryType; | 129 BinaryType m_binaryType; |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 } // namespace blink | 132 } // namespace blink |
| 132 | 133 |
| 133 #endif // PresentationConnection_h | 134 #endif // PresentationConnection_h |
| OLD | NEW |