| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "modules/websockets/WebSocketChannelClient.h" | 34 #include "modules/websockets/WebSocketChannelClient.h" |
| 35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 36 #include "public/platform/WebCommon.h" | 36 #include "public/platform/WebCommon.h" |
| 37 #include "public/platform/WebString.h" | 37 #include "public/platform/WebString.h" |
| 38 #include "public/web/WebSocket.h" | 38 #include "public/web/WebSocket.h" |
| 39 #include "public/web/WebSocketClient.h" | 39 #include "public/web/WebSocketClient.h" |
| 40 #include "wtf/OwnPtr.h" | 40 #include "wtf/OwnPtr.h" |
| 41 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
| 42 | 42 |
| 43 namespace WebCore { class WebSocketChannel; } | 43 namespace blink { class WebSocketChannel; } |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class WebDocument; | 47 class WebDocument; |
| 48 class WebURL; | 48 class WebURL; |
| 49 | 49 |
| 50 class WebSocketImpl FINAL : public NoBaseWillBeGarbageCollectedFinalized<WebSock
etImpl>, public WebSocket, public WebCore::WebSocketChannelClient { | 50 class WebSocketImpl FINAL : public NoBaseWillBeGarbageCollectedFinalized<WebSock
etImpl>, public WebSocket, public blink::WebSocketChannelClient { |
| 51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebSocketImpl) | 51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebSocketImpl) |
| 52 public: | 52 public: |
| 53 WebSocketImpl(const WebDocument&, WebSocketClient*); | 53 WebSocketImpl(const WebDocument&, WebSocketClient*); |
| 54 virtual ~WebSocketImpl(); | 54 virtual ~WebSocketImpl(); |
| 55 | 55 |
| 56 bool isNull() const { return !m_private; } | 56 bool isNull() const { return !m_private; } |
| 57 | 57 |
| 58 virtual BinaryType binaryType() const OVERRIDE; | 58 virtual BinaryType binaryType() const OVERRIDE; |
| 59 virtual bool setBinaryType(BinaryType) OVERRIDE; | 59 virtual bool setBinaryType(BinaryType) OVERRIDE; |
| 60 virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE; | 60 virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE; |
| 61 virtual WebString subprotocol() OVERRIDE; | 61 virtual WebString subprotocol() OVERRIDE; |
| 62 virtual WebString extensions() OVERRIDE; | 62 virtual WebString extensions() OVERRIDE; |
| 63 virtual bool sendText(const WebString&) OVERRIDE; | 63 virtual bool sendText(const WebString&) OVERRIDE; |
| 64 virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE; | 64 virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE; |
| 65 virtual unsigned long bufferedAmount() const OVERRIDE; | 65 virtual unsigned long bufferedAmount() const OVERRIDE; |
| 66 virtual void close(int code, const WebString& reason) OVERRIDE; | 66 virtual void close(int code, const WebString& reason) OVERRIDE; |
| 67 virtual void fail(const WebString& reason) OVERRIDE; | 67 virtual void fail(const WebString& reason) OVERRIDE; |
| 68 virtual void disconnect() OVERRIDE; | 68 virtual void disconnect() OVERRIDE; |
| 69 | 69 |
| 70 // WebSocketChannelClient | 70 // WebSocketChannelClient |
| 71 virtual void didConnect(const String& subprotocol, const String& extensions)
OVERRIDE; | 71 virtual void didConnect(const String& subprotocol, const String& extensions)
OVERRIDE; |
| 72 virtual void didReceiveMessage(const String& message) OVERRIDE; | 72 virtual void didReceiveMessage(const String& message) OVERRIDE; |
| 73 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) OVER
RIDE; | 73 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) OVER
RIDE; |
| 74 virtual void didReceiveMessageError() OVERRIDE; | 74 virtual void didReceiveMessageError() OVERRIDE; |
| 75 virtual void didConsumeBufferedAmount(unsigned long consumed) OVERRIDE; | 75 virtual void didConsumeBufferedAmount(unsigned long consumed) OVERRIDE; |
| 76 virtual void didStartClosingHandshake() OVERRIDE; | 76 virtual void didStartClosingHandshake() OVERRIDE; |
| 77 virtual void didClose(ClosingHandshakeCompletionStatus, unsigned short code,
const String& reason) OVERRIDE; | 77 virtual void didClose(ClosingHandshakeCompletionStatus, unsigned short code,
const String& reason) OVERRIDE; |
| 78 | 78 |
| 79 virtual void trace(WebCore::Visitor*) OVERRIDE; | 79 virtual void trace(blink::Visitor*) OVERRIDE; |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 RefPtrWillBeMember<WebCore::WebSocketChannel> m_private; | 82 RefPtrWillBeMember<blink::WebSocketChannel> m_private; |
| 83 WebSocketClient* m_client; | 83 WebSocketClient* m_client; |
| 84 BinaryType m_binaryType; | 84 BinaryType m_binaryType; |
| 85 WebString m_subprotocol; | 85 WebString m_subprotocol; |
| 86 WebString m_extensions; | 86 WebString m_extensions; |
| 87 bool m_isClosingOrClosed; | 87 bool m_isClosingOrClosed; |
| 88 // m_bufferedAmount includes m_bufferedAmountAfterClose. | 88 // m_bufferedAmount includes m_bufferedAmountAfterClose. |
| 89 unsigned long m_bufferedAmount; | 89 unsigned long m_bufferedAmount; |
| 90 unsigned long m_bufferedAmountAfterClose; | 90 unsigned long m_bufferedAmountAfterClose; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace blink | 93 } // namespace blink |
| 94 | 94 |
| 95 #endif // WebWebSocketChannelImpl_h | 95 #endif // WebWebSocketChannelImpl_h |
| OLD | NEW |