Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ | |
| 6 #define PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 | |
| 10 #include "base/observer_list_threadsafe.h" | |
| 11 #include "base/synchronization/lock.h" | |
|
dmichael (off chromium)
2012/03/15 20:01:28
You shouldn't need this include (and it's probably
Sergey Ulanov
2012/03/15 22:18:00
Done.
| |
| 12 #include "ppapi/proxy/interface_proxy.h" | |
| 13 #include "ppapi/shared_impl/ppb_network_list_private_shared.h" | |
| 14 #include "ppapi/shared_impl/scoped_pp_resource.h" | |
| 15 #include "ppapi/thunk/ppb_network_monitor_private_api.h" | |
| 16 | |
| 17 namespace base { | |
| 18 class MessageLoopProxy; | |
| 19 } // namespace base | |
| 20 | |
| 21 namespace ppapi { | |
| 22 namespace proxy { | |
| 23 | |
| 24 class PPAPI_SHARED_EXPORT PPB_NetworkMonitor_Private_Proxy | |
| 25 : public InterfaceProxy { | |
| 26 public: | |
| 27 PPB_NetworkMonitor_Private_Proxy(Dispatcher* dispatcher); | |
|
dmichael (off chromium)
2012/03/15 20:01:28
nit: explicit
Sergey Ulanov
2012/03/15 22:18:00
Done.
| |
| 28 virtual ~PPB_NetworkMonitor_Private_Proxy(); | |
| 29 | |
| 30 // Creates an NetworkManager object in the plugin process. | |
|
dmichael (off chromium)
2012/03/15 20:01:28
nit: an->a
Sergey Ulanov
2012/03/15 22:18:00
Done.
| |
| 31 static PP_Resource CreateProxyResource(PP_Instance instance, | |
| 32 PPB_NetworkMonitor_Callback callback, | |
| 33 void* user_data); | |
| 34 | |
| 35 // InterfaceProxy implementation. | |
| 36 virtual bool OnMessageReceived(const IPC::Message& msg); | |
| 37 | |
| 38 static const ApiID kApiID = API_ID_PPB_NETWORKMANAGER_PRIVATE; | |
| 39 | |
| 40 private: | |
| 41 class NetworkMonitor; | |
| 42 friend class NetworkMonitor; | |
| 43 | |
| 44 // IPC message handler for the messages received from the browser. | |
| 45 void OnPluginMsgNetworkList(uint32 plugin_dispatcher_id, | |
| 46 const ppapi::NetworkList& list); | |
| 47 | |
| 48 // Called by NetworkMonitor destructor. | |
| 49 void OnNetworkMonitorDeleted(NetworkMonitor* monitor, | |
| 50 PP_Instance instance); | |
| 51 | |
| 52 scoped_refptr<ObserverListThreadSafe<NetworkMonitor> > monitors_; | |
| 53 | |
| 54 // The lock must be acquired when accessing |monitors_count__| and | |
| 55 // |current_list_|. | |
| 56 base::Lock lock_; | |
|
dmichael (off chromium)
2012/03/15 20:01:28
The entire proxy will be behind 1 big lock, so thi
Sergey Ulanov
2012/03/15 22:18:00
I didn't know about it. Will it properly handle th
| |
| 57 int monitors_count_; | |
| 58 scoped_refptr<NetworkListStorage> current_list_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(PPB_NetworkMonitor_Private_Proxy); | |
| 61 }; | |
| 62 | |
| 63 } // namespace proxy | |
| 64 } // namespace ppapi | |
| 65 | |
| 66 #endif // PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ | |
| OLD | NEW |