| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DOMWebSocket_h | 31 #ifndef DOMWebSocket_h |
| 32 #define DOMWebSocket_h | 32 #define DOMWebSocket_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ActiveScriptWrappable.h" | 34 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 35 #include "bindings/core/v8/ScriptWrappable.h" | 35 #include "bindings/core/v8/ScriptWrappable.h" |
| 36 #include "core/dom/ActiveDOMObject.h" | 36 #include "core/dom/SuspendableObject.h" |
| 37 #include "core/events/EventListener.h" | 37 #include "core/events/EventListener.h" |
| 38 #include "core/events/EventTarget.h" | 38 #include "core/events/EventTarget.h" |
| 39 #include "modules/EventTargetModules.h" | 39 #include "modules/EventTargetModules.h" |
| 40 #include "modules/ModulesExport.h" | 40 #include "modules/ModulesExport.h" |
| 41 #include "modules/websockets/WebSocketChannel.h" | 41 #include "modules/websockets/WebSocketChannel.h" |
| 42 #include "modules/websockets/WebSocketChannelClient.h" | 42 #include "modules/websockets/WebSocketChannelClient.h" |
| 43 #include "platform/Timer.h" | 43 #include "platform/Timer.h" |
| 44 #include "platform/heap/Handle.h" | 44 #include "platform/heap/Handle.h" |
| 45 #include "platform/weborigin/KURL.h" | 45 #include "platform/weborigin/KURL.h" |
| 46 #include "wtf/Deque.h" | 46 #include "wtf/Deque.h" |
| 47 #include "wtf/Forward.h" | 47 #include "wtf/Forward.h" |
| 48 #include "wtf/PassRefPtr.h" | 48 #include "wtf/PassRefPtr.h" |
| 49 #include "wtf/RefPtr.h" | 49 #include "wtf/RefPtr.h" |
| 50 #include "wtf/text/WTFString.h" | 50 #include "wtf/text/WTFString.h" |
| 51 #include <memory> | 51 #include <memory> |
| 52 #include <stddef.h> | 52 #include <stddef.h> |
| 53 #include <stdint.h> | 53 #include <stdint.h> |
| 54 | 54 |
| 55 namespace blink { | 55 namespace blink { |
| 56 | 56 |
| 57 class Blob; | 57 class Blob; |
| 58 class DOMArrayBuffer; | 58 class DOMArrayBuffer; |
| 59 class DOMArrayBufferView; | 59 class DOMArrayBufferView; |
| 60 class ExceptionState; | 60 class ExceptionState; |
| 61 class ExecutionContext; | 61 class ExecutionContext; |
| 62 class StringOrStringSequence; | 62 class StringOrStringSequence; |
| 63 | 63 |
| 64 class MODULES_EXPORT DOMWebSocket : public EventTargetWithInlineData, | 64 class MODULES_EXPORT DOMWebSocket : public EventTargetWithInlineData, |
| 65 public ActiveScriptWrappable, | 65 public ActiveScriptWrappable, |
| 66 public ActiveDOMObject, | 66 public SuspendableObject, |
| 67 public WebSocketChannelClient { | 67 public WebSocketChannelClient { |
| 68 DEFINE_WRAPPERTYPEINFO(); | 68 DEFINE_WRAPPERTYPEINFO(); |
| 69 USING_GARBAGE_COLLECTED_MIXIN(DOMWebSocket); | 69 USING_GARBAGE_COLLECTED_MIXIN(DOMWebSocket); |
| 70 | 70 |
| 71 public: | 71 public: |
| 72 static const char* subprotocolSeperator(); | 72 static const char* subprotocolSeperator(); |
| 73 // DOMWebSocket instances must be used with a wrapper since this class's | 73 // DOMWebSocket instances must be used with a wrapper since this class's |
| 74 // lifetime management is designed assuming the V8 holds a ref on it while | 74 // lifetime management is designed assuming the V8 holds a ref on it while |
| 75 // hasPendingActivity() returns true. | 75 // hasPendingActivity() returns true. |
| 76 static DOMWebSocket* create(ExecutionContext*, | 76 static DOMWebSocket* create(ExecutionContext*, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); | 115 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); |
| 116 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 116 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 117 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 117 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 118 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 118 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
| 119 | 119 |
| 120 // EventTarget functions. | 120 // EventTarget functions. |
| 121 const AtomicString& interfaceName() const override; | 121 const AtomicString& interfaceName() const override; |
| 122 ExecutionContext* getExecutionContext() const override; | 122 ExecutionContext* getExecutionContext() const override; |
| 123 | 123 |
| 124 // ActiveDOMObject functions. | 124 // SuspendableObject functions. |
| 125 void contextDestroyed() override; | 125 void contextDestroyed() override; |
| 126 void suspend() override; | 126 void suspend() override; |
| 127 void resume() override; | 127 void resume() override; |
| 128 | 128 |
| 129 // ScriptWrappable functions. | 129 // ScriptWrappable functions. |
| 130 // Prevent this instance from being collected while it's not in CLOSED | 130 // Prevent this instance from being collected while it's not in CLOSED |
| 131 // state. | 131 // state. |
| 132 bool hasPendingActivity() const final; | 132 bool hasPendingActivity() const final; |
| 133 | 133 |
| 134 // WebSocketChannelClient functions. | 134 // WebSocketChannelClient functions. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 String m_subprotocol; | 252 String m_subprotocol; |
| 253 String m_extensions; | 253 String m_extensions; |
| 254 | 254 |
| 255 Member<EventQueue> m_eventQueue; | 255 Member<EventQueue> m_eventQueue; |
| 256 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer; | 256 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer; |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 } // namespace blink | 259 } // namespace blink |
| 260 | 260 |
| 261 #endif // DOMWebSocket_h | 261 #endif // DOMWebSocket_h |
| OLD | NEW |