| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 17 matching lines...) Expand all Loading... |
| 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 WebSocketChannel_h | 31 #ifndef WebSocketChannel_h |
| 32 #define WebSocketChannel_h | 32 #define WebSocketChannel_h |
| 33 | 33 |
| 34 #include "core/frame/ConsoleTypes.h" | 34 #include "core/frame/ConsoleTypes.h" |
| 35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
| 37 #include "wtf/Noncopyable.h" | 37 #include "wtf/Noncopyable.h" |
| 38 #include "wtf/text/WTFString.h" | |
| 39 | 38 |
| 40 namespace blink { | 39 namespace blink { |
| 41 | 40 |
| 42 class BlobDataHandle; | 41 class BlobDataHandle; |
| 42 class DOMArrayBuffer; |
| 43 class ExecutionContext; |
| 43 class KURL; | 44 class KURL; |
| 44 class ExecutionContext; | |
| 45 class WebSocketChannelClient; | 45 class WebSocketChannelClient; |
| 46 | 46 |
| 47 // FIXME: WebSocketChannel needs to be RefCountedGarbageCollected to support man
ual ref/deref | 47 // FIXME: WebSocketChannel needs to be RefCountedGarbageCollected to support man
ual ref/deref |
| 48 // in MainThreadWebSocketChannelImpl. We should change it to GarbageCollectedFin
alized once | 48 // in MainThreadWebSocketChannelImpl. We should change it to GarbageCollectedFin
alized once |
| 49 // we remove MainThreadWebSocketChannelImpl. | 49 // we remove MainThreadWebSocketChannelImpl. |
| 50 class WebSocketChannel : public RefCountedGarbageCollected<WebSocketChannel> { | 50 class WebSocketChannel : public RefCountedGarbageCollected<WebSocketChannel> { |
| 51 WTF_MAKE_NONCOPYABLE(WebSocketChannel); | 51 WTF_MAKE_NONCOPYABLE(WebSocketChannel); |
| 52 public: | 52 public: |
| 53 WebSocketChannel() { } | 53 WebSocketChannel() { } |
| 54 static WebSocketChannel* create(ExecutionContext*, WebSocketChannelClient*); | 54 static WebSocketChannel* create(ExecutionContext*, WebSocketChannelClient*); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 67 CloseEventCodeMessageTooBig = 1009, | 67 CloseEventCodeMessageTooBig = 1009, |
| 68 CloseEventCodeMandatoryExt = 1010, | 68 CloseEventCodeMandatoryExt = 1010, |
| 69 CloseEventCodeInternalError = 1011, | 69 CloseEventCodeInternalError = 1011, |
| 70 CloseEventCodeTLSHandshake = 1015, | 70 CloseEventCodeTLSHandshake = 1015, |
| 71 CloseEventCodeMinimumUserDefined = 3000, | 71 CloseEventCodeMinimumUserDefined = 3000, |
| 72 CloseEventCodeMaximumUserDefined = 4999 | 72 CloseEventCodeMaximumUserDefined = 4999 |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 virtual bool connect(const KURL&, const String& protocol) = 0; | 75 virtual bool connect(const KURL&, const String& protocol) = 0; |
| 76 virtual void send(const String& message) = 0; | 76 virtual void send(const String& message) = 0; |
| 77 virtual void send(const ArrayBuffer&, unsigned byteOffset, unsigned byteLeng
th) = 0; | 77 virtual void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteL
ength) = 0; |
| 78 virtual void send(PassRefPtr<BlobDataHandle>) = 0; | 78 virtual void send(PassRefPtr<BlobDataHandle>) = 0; |
| 79 | 79 |
| 80 // For WorkerWebSocketChannel. | 80 // For WorkerWebSocketChannel. |
| 81 virtual void send(PassOwnPtr<Vector<char> >) = 0; | 81 virtual void send(PassOwnPtr<Vector<char> >) = 0; |
| 82 | 82 |
| 83 // Do not call |send| after calling this method. | 83 // Do not call |send| after calling this method. |
| 84 virtual void close(int code, const String& reason) = 0; | 84 virtual void close(int code, const String& reason) = 0; |
| 85 | 85 |
| 86 // Log the reason text and close the connection. Will call didClose(). | 86 // Log the reason text and close the connection. Will call didClose(). |
| 87 // The MessageLevel parameter will be used for the level of the message | 87 // The MessageLevel parameter will be used for the level of the message |
| (...skipping 15 matching lines...) Expand all Loading... |
| 103 virtual void resume() = 0; | 103 virtual void resume() = 0; |
| 104 | 104 |
| 105 virtual ~WebSocketChannel() { } | 105 virtual ~WebSocketChannel() { } |
| 106 | 106 |
| 107 virtual void trace(Visitor*) { } | 107 virtual void trace(Visitor*) { } |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace blink | 110 } // namespace blink |
| 111 | 111 |
| 112 #endif // WebSocketChannel_h | 112 #endif // WebSocketChannel_h |
| OLD | NEW |