| 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_RENDERER_HOST_WEBSOCKET_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/shared_memory.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 18 #include "content/common/websocket.h" | 19 #include "content/common/websocket.h" |
| 19 | 20 |
| 20 class GURL; | 21 class GURL; |
| 21 | 22 |
| 22 namespace url { | 23 namespace url { |
| 23 class Origin; | 24 class Origin; |
| 24 } // namespace url | 25 } // namespace url |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const std::vector<char>& data); | 84 const std::vector<char>& data); |
| 84 | 85 |
| 85 void OnFlowControl(int64_t quota); | 86 void OnFlowControl(int64_t quota); |
| 86 | 87 |
| 87 void OnDropChannel(bool was_clean, uint16_t code, const std::string& reason); | 88 void OnDropChannel(bool was_clean, uint16_t code, const std::string& reason); |
| 88 | 89 |
| 89 void BlobSendComplete(int result); | 90 void BlobSendComplete(int result); |
| 90 | 91 |
| 91 // non-NULL if and only if this object is currently in "blob sending mode". | 92 // non-NULL if and only if this object is currently in "blob sending mode". |
| 92 std::unique_ptr<WebSocketBlobSender> blob_sender_; | 93 std::unique_ptr<WebSocketBlobSender> blob_sender_; |
| 94 void OnLoaderTransferTest_Setup(int buffer_size); |
| 95 void OnLoaderTransferTest_Send(int offset, int size); |
| 96 void OnLoaderTransferTest_Close(); |
| 93 | 97 |
| 94 // The channel we use to send events to the network. | 98 // The channel we use to send events to the network. |
| 95 std::unique_ptr<net::WebSocketChannel> channel_; | 99 std::unique_ptr<net::WebSocketChannel> channel_; |
| 96 | 100 |
| 97 // The WebSocketHostDispatcher that created this object. | 101 // The WebSocketHostDispatcher that created this object. |
| 98 WebSocketDispatcherHost* const dispatcher_; | 102 WebSocketDispatcherHost* const dispatcher_; |
| 99 | 103 |
| 100 // The URL request context for the channel. | 104 // The URL request context for the channel. |
| 101 net::URLRequestContext* const url_request_context_; | 105 net::URLRequestContext* const url_request_context_; |
| 102 | 106 |
| 103 // The ID used to route messages. | 107 // The ID used to route messages. |
| 104 const int routing_id_; | 108 const int routing_id_; |
| 105 | 109 |
| 106 // Delay used for per-renderer WebSocket throttling. | 110 // Delay used for per-renderer WebSocket throttling. |
| 107 base::TimeDelta delay_; | 111 base::TimeDelta delay_; |
| 108 | 112 |
| 109 // SendFlowControl() is delayed when OnFlowControl() is called before | 113 // SendFlowControl() is delayed when OnFlowControl() is called before |
| 110 // AddChannel() is called. | 114 // AddChannel() is called. |
| 111 // Zero indicates there is no pending SendFlowControl(). | 115 // Zero indicates there is no pending SendFlowControl(). |
| 112 int64_t pending_flow_control_quota_; | 116 int64_t pending_flow_control_quota_; |
| 113 | 117 |
| 114 // handshake_succeeded_ is set and used by WebSocketDispatcherHost | 118 // handshake_succeeded_ is set and used by WebSocketDispatcherHost |
| 115 // to manage counters for per-renderer WebSocket throttling. | 119 // to manage counters for per-renderer WebSocket throttling. |
| 116 bool handshake_succeeded_; | 120 bool handshake_succeeded_; |
| 117 | 121 |
| 122 std::unique_ptr<base::SharedMemory> shared_memory_; |
| 123 size_t loader_test_num_read_bytes_; |
| 124 |
| 118 base::WeakPtrFactory<WebSocketHost> weak_ptr_factory_; | 125 base::WeakPtrFactory<WebSocketHost> weak_ptr_factory_; |
| 119 | 126 |
| 120 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); | 127 DISALLOW_COPY_AND_ASSIGN(WebSocketHost); |
| 121 }; | 128 }; |
| 122 | 129 |
| 123 } // namespace content | 130 } // namespace content |
| 124 | 131 |
| 125 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ | 132 #endif // CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_HOST_H_ |
| OLD | NEW |