Chromium Code Reviews| Index: ppapi/proxy/ppb_network_monitor_private_proxy.h |
| diff --git a/ppapi/proxy/ppb_network_monitor_private_proxy.h b/ppapi/proxy/ppb_network_monitor_private_proxy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..14b8b320d88341a404d1d38a0ac7fe7e50b942c0 |
| --- /dev/null |
| +++ b/ppapi/proxy/ppb_network_monitor_private_proxy.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ |
| +#define PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ |
| + |
| +#include <list> |
| + |
| +#include "base/observer_list_threadsafe.h" |
| +#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.
|
| +#include "ppapi/proxy/interface_proxy.h" |
| +#include "ppapi/shared_impl/ppb_network_list_private_shared.h" |
| +#include "ppapi/shared_impl/scoped_pp_resource.h" |
| +#include "ppapi/thunk/ppb_network_monitor_private_api.h" |
| + |
| +namespace base { |
| +class MessageLoopProxy; |
| +} // namespace base |
| + |
| +namespace ppapi { |
| +namespace proxy { |
| + |
| +class PPAPI_SHARED_EXPORT PPB_NetworkMonitor_Private_Proxy |
| + : public InterfaceProxy { |
| + public: |
| + 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.
|
| + virtual ~PPB_NetworkMonitor_Private_Proxy(); |
| + |
| + // 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.
|
| + static PP_Resource CreateProxyResource(PP_Instance instance, |
| + PPB_NetworkMonitor_Callback callback, |
| + void* user_data); |
| + |
| + // InterfaceProxy implementation. |
| + virtual bool OnMessageReceived(const IPC::Message& msg); |
| + |
| + static const ApiID kApiID = API_ID_PPB_NETWORKMANAGER_PRIVATE; |
| + |
| + private: |
| + class NetworkMonitor; |
| + friend class NetworkMonitor; |
| + |
| + // IPC message handler for the messages received from the browser. |
| + void OnPluginMsgNetworkList(uint32 plugin_dispatcher_id, |
| + const ppapi::NetworkList& list); |
| + |
| + // Called by NetworkMonitor destructor. |
| + void OnNetworkMonitorDeleted(NetworkMonitor* monitor, |
| + PP_Instance instance); |
| + |
| + scoped_refptr<ObserverListThreadSafe<NetworkMonitor> > monitors_; |
| + |
| + // The lock must be acquired when accessing |monitors_count__| and |
| + // |current_list_|. |
| + 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
|
| + int monitors_count_; |
| + scoped_refptr<NetworkListStorage> current_list_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PPB_NetworkMonitor_Private_Proxy); |
| +}; |
| + |
| +} // namespace proxy |
| +} // namespace ppapi |
| + |
| +#endif // PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ |