| 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_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_MANAGER_H_ | 6 #define CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "content/browser/websockets/websocket_impl.h" | 14 #include "content/browser/websockets/websocket_impl.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
| 17 #include "net/url_request/url_request_context_getter_observer.h" | 17 #include "net/url_request/url_request_context_getter_observer.h" |
| 18 | 18 |
| 19 namespace service_manager { |
| 20 struct BindSourceInfo; |
| 21 } |
| 22 |
| 19 namespace content { | 23 namespace content { |
| 20 class StoragePartition; | 24 class StoragePartition; |
| 21 | 25 |
| 22 // The WebSocketManager is a per child process instance that manages the | 26 // The WebSocketManager is a per child process instance that manages the |
| 23 // lifecycle of WebSocketImpl objects. It is responsible for creating | 27 // lifecycle of WebSocketImpl objects. It is responsible for creating |
| 24 // WebSocketImpl objects for each WebSocketRequest and throttling the number of | 28 // WebSocketImpl objects for each WebSocketRequest and throttling the number of |
| 25 // WebSocketImpl objects in use. | 29 // WebSocketImpl objects in use. |
| 26 class CONTENT_EXPORT WebSocketManager | 30 class CONTENT_EXPORT WebSocketManager |
| 27 : NON_EXPORTED_BASE(public WebSocketImpl::Delegate), | 31 : NON_EXPORTED_BASE(public WebSocketImpl::Delegate), |
| 28 NON_EXPORTED_BASE(public net::URLRequestContextGetterObserver) { | 32 NON_EXPORTED_BASE(public net::URLRequestContextGetterObserver) { |
| 29 public: | 33 public: |
| 30 // Called on the UI thread: | 34 // Called on the UI thread: |
| 31 static void CreateWebSocket(int process_id, int frame_id, | 35 static void CreateWebSocket( |
| 32 blink::mojom::WebSocketRequest request); | 36 int process_id, |
| 37 int frame_id, |
| 38 const service_manager::BindSourceInfo& source_info, |
| 39 blink::mojom::WebSocketRequest request); |
| 33 | 40 |
| 34 // net::URLRequestContextGetterObserver implementation. | 41 // net::URLRequestContextGetterObserver implementation. |
| 35 void OnContextShuttingDown() override; | 42 void OnContextShuttingDown() override; |
| 36 | 43 |
| 37 protected: | 44 protected: |
| 38 class Handle; | 45 class Handle; |
| 39 friend class base::DeleteHelper<WebSocketManager>; | 46 friend class base::DeleteHelper<WebSocketManager>; |
| 40 | 47 |
| 41 // Called on the UI thread: | 48 // Called on the UI thread: |
| 42 WebSocketManager(int process_id, StoragePartition* storage_partition); | 49 WebSocketManager(int process_id, StoragePartition* storage_partition); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 int64_t num_previous_failed_connections_; | 94 int64_t num_previous_failed_connections_; |
| 88 | 95 |
| 89 bool context_destroyed_; | 96 bool context_destroyed_; |
| 90 | 97 |
| 91 DISALLOW_COPY_AND_ASSIGN(WebSocketManager); | 98 DISALLOW_COPY_AND_ASSIGN(WebSocketManager); |
| 92 }; | 99 }; |
| 93 | 100 |
| 94 } // namespace content | 101 } // namespace content |
| 95 | 102 |
| 96 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_MANAGER_H_ | 103 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_MANAGER_H_ |
| OLD | NEW |