| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 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 WebSocketChannel_h | 31 #ifndef WebSocketChannel_h |
| 32 #define WebSocketChannel_h | 32 #define WebSocketChannel_h |
| 33 | 33 |
| 34 #include "core/inspector/ScriptCallFrame.h" |
| 35 #include "core/inspector/ScriptCallStack.h" |
| 36 #include "core/page/ConsoleTypes.h" |
| 34 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 35 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
| 39 #include "wtf/PassOwnPtr.h" |
| 36 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 41 #include "wtf/Vector.h" |
| 37 | 42 |
| 38 namespace WebCore { | 43 namespace WebCore { |
| 39 | 44 |
| 40 class Blob; | 45 class Blob; |
| 41 class KURL; | 46 class KURL; |
| 42 class ScriptExecutionContext; | 47 class ScriptExecutionContext; |
| 43 class WebSocketChannelClient; | 48 class WebSocketChannelClient; |
| 44 | 49 |
| 45 class WebSocketChannel { | 50 class WebSocketChannel { |
| 46 WTF_MAKE_NONCOPYABLE(WebSocketChannel); | 51 WTF_MAKE_NONCOPYABLE(WebSocketChannel); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 66 CloseEventCodeInvalidFramePayloadData = 1007, | 71 CloseEventCodeInvalidFramePayloadData = 1007, |
| 67 CloseEventCodePolicyViolation = 1008, | 72 CloseEventCodePolicyViolation = 1008, |
| 68 CloseEventCodeMessageTooBig = 1009, | 73 CloseEventCodeMessageTooBig = 1009, |
| 69 CloseEventCodeMandatoryExt = 1010, | 74 CloseEventCodeMandatoryExt = 1010, |
| 70 CloseEventCodeInternalError = 1011, | 75 CloseEventCodeInternalError = 1011, |
| 71 CloseEventCodeTLSHandshake = 1015, | 76 CloseEventCodeTLSHandshake = 1015, |
| 72 CloseEventCodeMinimumUserDefined = 3000, | 77 CloseEventCodeMinimumUserDefined = 3000, |
| 73 CloseEventCodeMaximumUserDefined = 4999 | 78 CloseEventCodeMaximumUserDefined = 4999 |
| 74 }; | 79 }; |
| 75 | 80 |
| 81 class CallStackWrapper { |
| 82 public: |
| 83 CallStackWrapper(const Vector<ScriptCallFrame>& frames): m_frames(frames
) { } |
| 84 PassRefPtr<ScriptCallStack> callStack() { return ScriptCallStack::create
(m_frames); } |
| 85 |
| 86 private: |
| 87 Vector<ScriptCallFrame> m_frames; |
| 88 }; |
| 89 |
| 76 virtual void connect(const KURL&, const String& protocol) = 0; | 90 virtual void connect(const KURL&, const String& protocol) = 0; |
| 77 virtual String subprotocol() = 0; // Will be available after didConnect() ca
llback is invoked. | 91 virtual String subprotocol() = 0; // Will be available after didConnect() ca
llback is invoked. |
| 78 virtual String extensions() = 0; // Will be available after didConnect() cal
lback is invoked. | 92 virtual String extensions() = 0; // Will be available after didConnect() cal
lback is invoked. |
| 79 virtual SendResult send(const String& message) = 0; | 93 virtual SendResult send(const String& message) = 0; |
| 80 virtual SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned by
teLength) = 0; | 94 virtual SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned by
teLength) = 0; |
| 81 virtual SendResult send(const Blob&) = 0; | 95 virtual SendResult send(const Blob&) = 0; |
| 82 virtual unsigned long bufferedAmount() const = 0; | 96 virtual unsigned long bufferedAmount() const = 0; |
| 83 virtual void close(int code, const String& reason) = 0; | 97 virtual void close(int code, const String& reason) = 0; |
| 84 // Log the reason text and close the connection. Will call didClose(). | 98 // Log the reason text and close the connection. Will call didClose(). |
| 85 virtual void fail(const String& reason) = 0; | 99 virtual void fail(const String& reason, MessageLevel) = 0; |
| 100 virtual void fail(const String& reason, MessageLevel, PassOwnPtr<CallStackWr
apper>) = 0; |
| 86 virtual void disconnect() = 0; // Will suppress didClose(). | 101 virtual void disconnect() = 0; // Will suppress didClose(). |
| 87 | 102 |
| 88 virtual void suspend() = 0; | 103 virtual void suspend() = 0; |
| 89 virtual void resume() = 0; | 104 virtual void resume() = 0; |
| 90 | 105 |
| 91 void ref() { refWebSocketChannel(); } | 106 void ref() { refWebSocketChannel(); } |
| 92 void deref() { derefWebSocketChannel(); } | 107 void deref() { derefWebSocketChannel(); } |
| 93 | 108 |
| 94 protected: | 109 protected: |
| 95 virtual ~WebSocketChannel() { } | 110 virtual ~WebSocketChannel() { } |
| 96 virtual void refWebSocketChannel() = 0; | 111 virtual void refWebSocketChannel() = 0; |
| 97 virtual void derefWebSocketChannel() = 0; | 112 virtual void derefWebSocketChannel() = 0; |
| 98 }; | 113 }; |
| 99 | 114 |
| 100 } // namespace WebCore | 115 } // namespace WebCore |
| 101 | 116 |
| 102 #endif // WebSocketChannel_h | 117 #endif // WebSocketChannel_h |
| OLD | NEW |