| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ |
| 6 #define CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ | 6 #define CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public: | 39 public: |
| 40 virtual ~Delegate() {} | 40 virtual ~Delegate() {} |
| 41 virtual int GetClientProcessId() = 0; | 41 virtual int GetClientProcessId() = 0; |
| 42 virtual StoragePartition* GetStoragePartition() = 0; | 42 virtual StoragePartition* GetStoragePartition() = 0; |
| 43 virtual void OnReceivedResponseFromServer(WebSocketImpl* impl) = 0; | 43 virtual void OnReceivedResponseFromServer(WebSocketImpl* impl) = 0; |
| 44 virtual void OnLostConnectionToClient(WebSocketImpl* impl) = 0; | 44 virtual void OnLostConnectionToClient(WebSocketImpl* impl) = 0; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 WebSocketImpl(Delegate* delegate, | 47 WebSocketImpl(Delegate* delegate, |
| 48 blink::mojom::WebSocketRequest request, | 48 blink::mojom::WebSocketRequest request, |
| 49 int child_id, |
| 49 int frame_id, | 50 int frame_id, |
| 50 base::TimeDelta delay); | 51 base::TimeDelta delay); |
| 51 ~WebSocketImpl() override; | 52 ~WebSocketImpl() override; |
| 52 | 53 |
| 53 // The renderer process is going away. | 54 // The renderer process is going away. |
| 54 // This function is virtual for testing. | 55 // This function is virtual for testing. |
| 55 virtual void GoAway(); | 56 virtual void GoAway(); |
| 56 | 57 |
| 57 // blink::mojom::WebSocket methods: | 58 // blink::mojom::WebSocket methods: |
| 58 void AddChannelRequest(const GURL& url, | 59 void AddChannelRequest(const GURL& url, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 89 std::unique_ptr<net::WebSocketChannel> channel_; | 90 std::unique_ptr<net::WebSocketChannel> channel_; |
| 90 | 91 |
| 91 // Delay used for per-renderer WebSocket throttling. | 92 // Delay used for per-renderer WebSocket throttling. |
| 92 base::TimeDelta delay_; | 93 base::TimeDelta delay_; |
| 93 | 94 |
| 94 // SendFlowControl() is delayed when OnFlowControl() is called before | 95 // SendFlowControl() is delayed when OnFlowControl() is called before |
| 95 // AddChannel() is called. | 96 // AddChannel() is called. |
| 96 // Zero indicates there is no pending SendFlowControl(). | 97 // Zero indicates there is no pending SendFlowControl(). |
| 97 int64_t pending_flow_control_quota_; | 98 int64_t pending_flow_control_quota_; |
| 98 | 99 |
| 100 int child_id_; |
| 99 int frame_id_; | 101 int frame_id_; |
| 100 | 102 |
| 101 // handshake_succeeded_ is set and used by WebSocketManager to manage | 103 // handshake_succeeded_ is set and used by WebSocketManager to manage |
| 102 // counters for per-renderer WebSocket throttling. | 104 // counters for per-renderer WebSocket throttling. |
| 103 bool handshake_succeeded_; | 105 bool handshake_succeeded_; |
| 104 | 106 |
| 105 base::WeakPtrFactory<WebSocketImpl> weak_ptr_factory_; | 107 base::WeakPtrFactory<WebSocketImpl> weak_ptr_factory_; |
| 106 | 108 |
| 107 DISALLOW_COPY_AND_ASSIGN(WebSocketImpl); | 109 DISALLOW_COPY_AND_ASSIGN(WebSocketImpl); |
| 108 }; | 110 }; |
| 109 | 111 |
| 110 } // namespace content | 112 } // namespace content |
| 111 | 113 |
| 112 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ | 114 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_IMPL_H_ |
| OLD | NEW |