OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // P2PSocketDispatcher is a per-renderer object that dispatchers all | 5 // P2PSocketDispatcher is a per-renderer object that dispatchers all |
6 // P2P messages received from the browser and relays all P2P messages | 6 // P2P messages received from the browser and relays all P2P messages |
7 // sent to the browser. P2PSocketClient instances register themselves | 7 // sent to the browser. P2PSocketClient instances register themselves |
8 // with the dispatcher using RegisterClient() and UnregisterClient(). | 8 // with the dispatcher using RegisterClient() and UnregisterClient(). |
9 // | 9 // |
10 // Relationship of classes. | 10 // Relationship of classes. |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 #include <vector> | 24 #include <vector> |
25 | 25 |
26 #include "base/callback_forward.h" | 26 #include "base/callback_forward.h" |
27 #include "base/compiler_specific.h" | 27 #include "base/compiler_specific.h" |
28 #include "base/id_map.h" | 28 #include "base/id_map.h" |
29 #include "base/observer_list_threadsafe.h" | 29 #include "base/observer_list_threadsafe.h" |
30 #include "base/synchronization/lock.h" | 30 #include "base/synchronization/lock.h" |
31 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
32 #include "content/common/p2p_socket_type.h" | 32 #include "content/common/p2p_socket_type.h" |
33 #include "content/renderer/p2p/network_list_manager.h" | |
33 #include "ipc/message_filter.h" | 34 #include "ipc/message_filter.h" |
34 #include "net/base/net_util.h" | 35 #include "net/base/net_util.h" |
35 | 36 |
36 namespace base { | 37 namespace base { |
37 class MessageLoopProxy; | 38 class MessageLoopProxy; |
38 } // namespace base | 39 } // namespace base |
39 | 40 |
40 namespace net { | 41 namespace net { |
41 class IPEndPoint; | 42 class IPEndPoint; |
42 } // namespace net | 43 } // namespace net |
43 | 44 |
44 namespace content { | 45 namespace content { |
45 | 46 |
46 class NetworkListObserver; | 47 class NetworkListObserver; |
47 class P2PAsyncAddressResolver; | 48 class P2PAsyncAddressResolver; |
48 class P2PSocketClientImpl; | 49 class P2PSocketClientImpl; |
49 class RenderViewImpl; | 50 class RenderViewImpl; |
50 | 51 |
51 class CONTENT_EXPORT P2PSocketDispatcher : public IPC::MessageFilter { | 52 class CONTENT_EXPORT P2PSocketDispatcher : |
53 public IPC::MessageFilter, public NetworkListManager { | |
Sergey Ulanov
2014/09/10 23:37:16
This should be formatted either like this:
class
guoweis_webrtc
2014/09/11 00:15:32
Done.
| |
52 public: | 54 public: |
53 explicit P2PSocketDispatcher(base::MessageLoopProxy* ipc_message_loop); | 55 explicit P2PSocketDispatcher(base::MessageLoopProxy* ipc_message_loop); |
54 | 56 |
55 // Add a new network list observer. Each observer is called | 57 // NetworkListManager interface: |
56 // immidiately after it is registered and then later whenever | 58 virtual void AddNetworkListObserver( |
57 // network configuration changes. Can be called on any thread. The | 59 NetworkListObserver* network_list_observer) OVERRIDE; |
58 // observer is always called on the thread it was added. | |
59 void AddNetworkListObserver(NetworkListObserver* network_list_observer); | |
60 | 60 |
Sergey Ulanov
2014/09/10 23:37:16
nit: remove this empty line
guoweis_webrtc
2014/09/11 00:15:32
Done.
| |
61 // Removes network list observer. Must be called on the thread on | 61 virtual void RemoveNetworkListObserver( |
62 // which the observer was added. | 62 NetworkListObserver* network_list_observer) OVERRIDE; |
63 void RemoveNetworkListObserver(NetworkListObserver* network_list_observer); | |
64 | 63 |
65 protected: | 64 protected: |
66 virtual ~P2PSocketDispatcher(); | 65 virtual ~P2PSocketDispatcher(); |
67 | 66 |
68 private: | 67 private: |
69 friend class P2PAsyncAddressResolver; | 68 friend class P2PAsyncAddressResolver; |
70 friend class P2PSocketClientImpl; | 69 friend class P2PSocketClientImpl; |
71 | 70 |
72 // Send a message asynchronously. | 71 // Send a message asynchronously. |
73 virtual void Send(IPC::Message* message); | 72 virtual void Send(IPC::Message* message); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 network_list_observers_; | 115 network_list_observers_; |
117 | 116 |
118 IPC::Sender* sender_; | 117 IPC::Sender* sender_; |
119 | 118 |
120 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); | 119 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); |
121 }; | 120 }; |
122 | 121 |
123 } // namespace content | 122 } // namespace content |
124 | 123 |
125 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 124 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
OLD | NEW |