Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1282)

Side by Side Diff: Source/web/WebSocketImpl.h

Issue 419973007: Decouple WebSocketChannelClient from WebSocketImpl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebSocketChannelClientProxy.h ('k') | Source/web/WebSocketImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 WebSocketChannel;
47 class WebSocketChannelClientProxy;
48 class WebURL; 48 class WebURL;
49 49
50 class WebSocketImpl FINAL : public NoBaseWillBeGarbageCollectedFinalized<WebSock etImpl>, public WebSocket, public blink::WebSocketChannelClient { 50 class WebSocketImpl FINAL : public WebSocket {
51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebSocketImpl)
52 public: 51 public:
53 WebSocketImpl(const WebDocument&, WebSocketClient*); 52 WebSocketImpl(const WebDocument&, WebSocketClient*);
54 virtual ~WebSocketImpl(); 53 virtual ~WebSocketImpl();
55 54
56 bool isNull() const { return !m_private; } 55 bool isNull() const { return !m_private; }
57 56
58 virtual BinaryType binaryType() const OVERRIDE; 57 virtual BinaryType binaryType() const OVERRIDE;
59 virtual bool setBinaryType(BinaryType) OVERRIDE; 58 virtual bool setBinaryType(BinaryType) OVERRIDE;
60 virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE; 59 virtual void connect(const WebURL&, const WebString& protocol) OVERRIDE;
61 virtual WebString subprotocol() OVERRIDE; 60 virtual WebString subprotocol() OVERRIDE;
62 virtual WebString extensions() OVERRIDE; 61 virtual WebString extensions() OVERRIDE;
63 virtual bool sendText(const WebString&) OVERRIDE; 62 virtual bool sendText(const WebString&) OVERRIDE;
64 virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE; 63 virtual bool sendArrayBuffer(const WebArrayBuffer&) OVERRIDE;
65 virtual unsigned long bufferedAmount() const OVERRIDE; 64 virtual unsigned long bufferedAmount() const OVERRIDE;
66 virtual void close(int code, const WebString& reason) OVERRIDE; 65 virtual void close(int code, const WebString& reason) OVERRIDE;
67 virtual void fail(const WebString& reason) OVERRIDE; 66 virtual void fail(const WebString& reason) OVERRIDE;
68 virtual void disconnect() OVERRIDE; 67 virtual void disconnect() OVERRIDE;
69 68
70 // WebSocketChannelClient 69 // WebSocketChannelClient methods proxied by WebSocketChannelClientProxy.
71 virtual void didConnect(const String& subprotocol, const String& extensions) OVERRIDE; 70 void didConnect(const String& subprotocol, const String& extensions);
72 virtual void didReceiveMessage(const String& message) OVERRIDE; 71 void didReceiveMessage(const String& message);
73 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) OVER RIDE; 72 void didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData);
74 virtual void didReceiveMessageError() OVERRIDE; 73 void didReceiveMessageError();
75 virtual void didConsumeBufferedAmount(unsigned long consumed) OVERRIDE; 74 void didConsumeBufferedAmount(unsigned long consumed);
76 virtual void didStartClosingHandshake() OVERRIDE; 75 void didStartClosingHandshake();
77 virtual void didClose(ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) OVERRIDE; 76 void didClose(WebSocketChannelClient::ClosingHandshakeCompletionStatus, unsi gned short code, const String& reason);
78
79 virtual void trace(blink::Visitor*) OVERRIDE;
80 77
81 private: 78 private:
82 RefPtrWillBeMember<blink::WebSocketChannel> m_private; 79 RefPtrWillBePersistent<blink::WebSocketChannel> m_private;
83 WebSocketClient* m_client; 80 WebSocketClient* m_client;
81 OwnPtrWillBePersistent<WebSocketChannelClientProxy> m_channelProxy;
84 BinaryType m_binaryType; 82 BinaryType m_binaryType;
85 WebString m_subprotocol; 83 WebString m_subprotocol;
86 WebString m_extensions; 84 WebString m_extensions;
87 bool m_isClosingOrClosed; 85 bool m_isClosingOrClosed;
88 // m_bufferedAmount includes m_bufferedAmountAfterClose. 86 // m_bufferedAmount includes m_bufferedAmountAfterClose.
89 unsigned long m_bufferedAmount; 87 unsigned long m_bufferedAmount;
90 unsigned long m_bufferedAmountAfterClose; 88 unsigned long m_bufferedAmountAfterClose;
91 }; 89 };
92 90
93 } // namespace blink 91 } // namespace blink
94 92
95 #endif // WebWebSocketChannelImpl_h 93 #endif // WebWebSocketChannelImpl_h
OLDNEW
« no previous file with comments | « Source/web/WebSocketChannelClientProxy.h ('k') | Source/web/WebSocketImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698