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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 PepperBrokerDispatcherWrapper(); | 35 PepperBrokerDispatcherWrapper(); |
36 ~PepperBrokerDispatcherWrapper(); | 36 ~PepperBrokerDispatcherWrapper(); |
37 | 37 |
38 bool Init(base::ProcessId broker_pid, | 38 bool Init(base::ProcessId broker_pid, |
39 const IPC::ChannelHandle& channel_handle); | 39 const IPC::ChannelHandle& channel_handle); |
40 | 40 |
41 int32_t SendHandleToBroker(PP_Instance instance, | 41 int32_t SendHandleToBroker(PP_Instance instance, |
42 base::SyncSocket::Handle handle); | 42 base::SyncSocket::Handle handle); |
43 | 43 |
44 private: | 44 private: |
45 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; | 45 std::unique_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; |
46 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; | 46 std::unique_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; |
47 }; | 47 }; |
48 | 48 |
49 class PepperBroker : public base::RefCountedThreadSafe<PepperBroker> { | 49 class PepperBroker : public base::RefCountedThreadSafe<PepperBroker> { |
50 public: | 50 public: |
51 explicit PepperBroker(PluginModule* plugin_module); | 51 explicit PepperBroker(PluginModule* plugin_module); |
52 | 52 |
53 // Decrements the references to the broker. | 53 // Decrements the references to the broker. |
54 // When there are no more references, this renderer's dispatcher is | 54 // When there are no more references, this renderer's dispatcher is |
55 // destroyed, allowing the broker to shutdown if appropriate. | 55 // destroyed, allowing the broker to shutdown if appropriate. |
56 // Callers should not reference this object after calling Disconnect(). | 56 // Callers should not reference this object after calling Disconnect(). |
(...skipping 23 matching lines...) Expand all Loading... |
80 }; | 80 }; |
81 | 81 |
82 virtual ~PepperBroker(); | 82 virtual ~PepperBroker(); |
83 | 83 |
84 // Reports failure to all clients that had pending operations. | 84 // Reports failure to all clients that had pending operations. |
85 void ReportFailureToClients(int error_code); | 85 void ReportFailureToClients(int error_code); |
86 | 86 |
87 // Connects the plugin to the broker via a pipe. | 87 // Connects the plugin to the broker via a pipe. |
88 void ConnectPluginToBroker(PPB_Broker_Impl* client); | 88 void ConnectPluginToBroker(PPB_Broker_Impl* client); |
89 | 89 |
90 scoped_ptr<PepperBrokerDispatcherWrapper> dispatcher_; | 90 std::unique_ptr<PepperBrokerDispatcherWrapper> dispatcher_; |
91 | 91 |
92 // A map of pointers to objects that have requested a connection to the weak | 92 // A map of pointers to objects that have requested a connection to the weak |
93 // pointer we can use to reference them. The mapping is needed so we can clean | 93 // pointer we can use to reference them. The mapping is needed so we can clean |
94 // up entries for objects that may have been deleted. | 94 // up entries for objects that may have been deleted. |
95 typedef std::map<PPB_Broker_Impl*, PendingConnection> ClientMap; | 95 typedef std::map<PPB_Broker_Impl*, PendingConnection> ClientMap; |
96 ClientMap pending_connects_; | 96 ClientMap pending_connects_; |
97 | 97 |
98 // Pointer to the associated plugin module. | 98 // Pointer to the associated plugin module. |
99 // Always set and cleared at the same time as the module's pointer to this. | 99 // Always set and cleared at the same time as the module's pointer to this. |
100 PluginModule* plugin_module_; | 100 PluginModule* plugin_module_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(PepperBroker); | 102 DISALLOW_COPY_AND_ASSIGN(PepperBroker); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace content | 105 } // namespace content |
106 | 106 |
107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ | 107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ |
OLD | NEW |