Chromium Code Reviews| 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 blink { class WebSocketChannel; } | |
| 44 | |
| 45 namespace blink { | 43 namespace blink { |
| 46 | 44 |
| 47 class WebDocument; | 45 class WebDocument; |
| 46 class WebSocketChannelClientProxy; | |
| 48 class WebURL; | 47 class WebURL; |
|
yhirano
2014/08/04 01:05:53
+class WebSocketChannel;
haraken
2014/08/04 01:21:57
Done.
| |
| 49 | 48 |
| 50 class WebSocketImpl FINAL : public NoBaseWillBeGarbageCollectedFinalized<WebSock etImpl>, public WebSocket, public blink::WebSocketChannelClient { | 49 class WebSocketImpl FINAL : public WebSocket { |
| 51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebSocketImpl) | |
| 52 public: | 50 public: |
| 53 WebSocketImpl(const WebDocument&, WebSocketClient*); | 51 WebSocketImpl(const WebDocument&, WebSocketClient*); |
| 54 virtual ~WebSocketImpl(); | 52 virtual ~WebSocketImpl(); |
| 55 | 53 |
| 56 bool isNull() const { return !m_private; } | 54 bool isNull() const { return !m_private; } |
| 57 | 55 |
| 58 virtual BinaryType binaryType() const OVERRIDE; | 56 virtual BinaryType binaryType() const OVERRIDE; |
| 59 virtual bool setBinaryType(BinaryType) OVERRIDE; | 57 virtual bool setBinaryType(BinaryType) OVERRIDE; |
| 60 virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE; | 58 virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE; |
| 61 virtual WebString subprotocol() OVERRIDE; | 59 virtual WebString subprotocol() OVERRIDE; |
| 62 virtual WebString extensions() OVERRIDE; | 60 virtual WebString extensions() OVERRIDE; |
| 63 virtual bool sendText(const WebString&) OVERRIDE; | 61 virtual bool sendText(const WebString&) OVERRIDE; |
| 64 virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE; | 62 virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE; |
| 65 virtual unsigned long bufferedAmount() const OVERRIDE; | 63 virtual unsigned long bufferedAmount() const OVERRIDE; |
| 66 virtual void close(int code, const WebString& reason) OVERRIDE; | 64 virtual void close(int code, const WebString& reason) OVERRIDE; |
| 67 virtual void fail(const WebString& reason) OVERRIDE; | 65 virtual void fail(const WebString& reason) OVERRIDE; |
| 68 virtual void disconnect() OVERRIDE; | 66 virtual void disconnect() OVERRIDE; |
| 69 | 67 |
| 70 // WebSocketChannelClient | 68 // WebSocketChannelClient methods proxied by WebSocketChannelClientProxy. |
| 71 virtual void didConnect(const String& subprotocol, const String& extensions) OVERRIDE; | 69 void didConnect(const String& subprotocol, const String& extensions); |
| 72 virtual void didReceiveMessage(const String& message) OVERRIDE; | 70 void didReceiveMessage(const String& message); |
| 73 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) OVER RIDE; | 71 void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData); |
| 74 virtual void didReceiveMessageError() OVERRIDE; | 72 void didReceiveMessageError(); |
| 75 virtual void didConsumeBufferedAmount(unsigned long consumed) OVERRIDE; | 73 void didConsumeBufferedAmount(unsigned long consumed); |
| 76 virtual void didStartClosingHandshake() OVERRIDE; | 74 void didStartClosingHandshake(); |
| 77 virtual void didClose(ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) OVERRIDE; | 75 void didClose(WebSocketChannelClient::ClosingHandshakeCompletionStatus, unsi gned short code, const String& reason); |
| 78 | |
| 79 virtual void trace(blink::Visitor*) OVERRIDE; | |
| 80 | 76 |
| 81 private: | 77 private: |
| 82 RefPtrWillBeMember<blink::WebSocketChannel> m_private; | 78 RefPtrWillBePersistent<blink::WebSocketChannel> m_private; |
| 83 WebSocketClient* m_client; | 79 WebSocketClient* m_client; |
| 80 OwnPtrWillBePersistent<WebSocketChannelClientProxy> m_channelProxy; | |
| 84 BinaryType m_binaryType; | 81 BinaryType m_binaryType; |
| 85 WebString m_subprotocol; | 82 WebString m_subprotocol; |
| 86 WebString m_extensions; | 83 WebString m_extensions; |
| 87 bool m_isClosingOrClosed; | 84 bool m_isClosingOrClosed; |
| 88 // m_bufferedAmount includes m_bufferedAmountAfterClose. | 85 // m_bufferedAmount includes m_bufferedAmountAfterClose. |
| 89 unsigned long m_bufferedAmount; | 86 unsigned long m_bufferedAmount; |
| 90 unsigned long m_bufferedAmountAfterClose; | 87 unsigned long m_bufferedAmountAfterClose; |
| 91 }; | 88 }; |
| 92 | 89 |
| 93 } // namespace blink | 90 } // namespace blink |
| 94 | 91 |
| 95 #endif // WebWebSocketChannelImpl_h | 92 #endif // WebWebSocketChannelImpl_h |
| OLD | NEW |