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

Side by Side Diff: content/browser/websockets/websocket_manager.h

Issue 2284473002: Move WebSocketHandleImpl into Blink (take 2) (Closed)
Patch Set: Rebase Created 4 years, 3 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
OLDNEW
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/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "content/browser/websockets/websocket_impl.h" 13 #include "content/browser/websockets/websocket_impl.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 15
16 namespace shell {
17 class InterfaceRegistry;
18 } // namespace shell
19
20 namespace content { 16 namespace content {
21 class StoragePartition; 17 class StoragePartition;
22 18
23 // The WebSocketManager is a per child process instance that manages the 19 // The WebSocketManager is a per child process instance that manages the
24 // lifecycle of WebSocketImpl objects. It is responsible for creating 20 // lifecycle of WebSocketImpl objects. It is responsible for creating
25 // WebSocketImpl objects for each WebSocketRequest and throttling the number of 21 // WebSocketImpl objects for each WebSocketRequest and throttling the number of
26 // WebSocketImpl objects in use. 22 // WebSocketImpl objects in use.
27 class CONTENT_EXPORT WebSocketManager 23 class CONTENT_EXPORT WebSocketManager
28 : NON_EXPORTED_BASE(public WebSocketImpl::Delegate) { 24 : NON_EXPORTED_BASE(public WebSocketImpl::Delegate) {
29 public: 25 public:
30 // Called on the UI thread: 26 // Called on the UI thread:
31 static void CreateWebSocket(int process_id, int frame_id, 27 static void CreateWebSocket(int process_id, int frame_id,
32 mojom::WebSocketRequest request); 28 blink::mojom::WebSocketRequest request);
33 29
34 protected: 30 protected:
35 class Handle; 31 class Handle;
36 friend class base::DeleteHelper<WebSocketManager>; 32 friend class base::DeleteHelper<WebSocketManager>;
37 33
38 // Called on the UI thread: 34 // Called on the UI thread:
39 WebSocketManager(int process_id, StoragePartition* storage_partition); 35 WebSocketManager(int process_id, StoragePartition* storage_partition);
40 36
41 // All other methods must run on the IO thread. 37 // All other methods must run on the IO thread.
42 38
43 ~WebSocketManager() override; 39 ~WebSocketManager() override;
44 void DoCreateWebSocket(int frame_id, mojom::WebSocketRequest request); 40 void DoCreateWebSocket(int frame_id, blink::mojom::WebSocketRequest request);
45 base::TimeDelta CalculateDelay() const; 41 base::TimeDelta CalculateDelay() const;
46 void ThrottlingPeriodTimerCallback(); 42 void ThrottlingPeriodTimerCallback();
47 43
48 // This is virtual to support testing. 44 // This is virtual to support testing.
49 virtual WebSocketImpl* CreateWebSocketImpl(WebSocketImpl::Delegate* delegate, 45 virtual WebSocketImpl* CreateWebSocketImpl(
50 mojom::WebSocketRequest request, 46 WebSocketImpl::Delegate* delegate,
51 int frame_id, 47 blink::mojom::WebSocketRequest request,
52 base::TimeDelta delay); 48 int frame_id,
49 base::TimeDelta delay);
53 50
54 // WebSocketImpl::Delegate methods: 51 // WebSocketImpl::Delegate methods:
55 int GetClientProcessId() override; 52 int GetClientProcessId() override;
56 StoragePartition* GetStoragePartition() override; 53 StoragePartition* GetStoragePartition() override;
57 void OnReceivedResponseFromServer(WebSocketImpl* impl) override; 54 void OnReceivedResponseFromServer(WebSocketImpl* impl) override;
58 void OnLostConnectionToClient(WebSocketImpl* impl) override; 55 void OnLostConnectionToClient(WebSocketImpl* impl) override;
59 56
60 int process_id_; 57 int process_id_;
61 StoragePartition* storage_partition_; 58 StoragePartition* storage_partition_;
62 59
(...skipping 14 matching lines...) Expand all
77 // period. 74 // period.
78 int64_t num_current_failed_connections_; 75 int64_t num_current_failed_connections_;
79 int64_t num_previous_failed_connections_; 76 int64_t num_previous_failed_connections_;
80 77
81 DISALLOW_COPY_AND_ASSIGN(WebSocketManager); 78 DISALLOW_COPY_AND_ASSIGN(WebSocketManager);
82 }; 79 };
83 80
84 } // namespace content 81 } // namespace content
85 82
86 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_MANAGER_H_ 83 #endif // CONTENT_BROWSER_WEBSOCKETS_WEBSOCKET_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/websockets/websocket_impl.cc ('k') | content/browser/websockets/websocket_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698