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

Side by Side Diff: content/renderer/pepper/pepper_broker.h

Issue 22300003: Move broker creation out of PepperHelperImpl to PPB_Broker_Impl in the effort to eliminate PepperHe… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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 "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "base/sync_socket.h" 10 #include "base/sync_socket.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "content/renderer/pepper/ppb_broker_impl.h" 12 #include "content/renderer/pepper/ppb_broker_impl.h"
13 #include "ppapi/proxy/proxy_channel.h" 13 #include "ppapi/proxy/proxy_channel.h"
14 14
15 namespace IPC { 15 namespace IPC {
16 struct ChannelHandle; 16 struct ChannelHandle;
17 } 17 }
18 18
19 namespace ppapi { 19 namespace ppapi {
20 namespace proxy { 20 namespace proxy {
21 class BrokerDispatcher; 21 class BrokerDispatcher;
22 } 22 }
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 26
27 class PepperHelperImpl;
28 class PluginModule; 27 class PluginModule;
29 28
30 // This object is NOT thread-safe. 29 // This object is NOT thread-safe.
31 class CONTENT_EXPORT PepperBrokerDispatcherWrapper { 30 class CONTENT_EXPORT PepperBrokerDispatcherWrapper {
32 public: 31 public:
33 PepperBrokerDispatcherWrapper(); 32 PepperBrokerDispatcherWrapper();
34 ~PepperBrokerDispatcherWrapper(); 33 ~PepperBrokerDispatcherWrapper();
35 34
36 bool Init(base::ProcessId broker_pid, 35 bool Init(base::ProcessId broker_pid,
37 const IPC::ChannelHandle& channel_handle); 36 const IPC::ChannelHandle& channel_handle);
38 37
39 int32_t SendHandleToBroker(PP_Instance instance, 38 int32_t SendHandleToBroker(PP_Instance instance,
40 base::SyncSocket::Handle handle); 39 base::SyncSocket::Handle handle);
41 40
42 private: 41 private:
43 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_; 42 scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_;
44 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; 43 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
45 }; 44 };
46 45
47 class PepperBroker : public base::RefCountedThreadSafe<PepperBroker>{ 46 class PepperBroker : public base::RefCountedThreadSafe<PepperBroker>{
48 public: 47 public:
49 PepperBroker(PluginModule* plugin_module, PepperHelperImpl* helper); 48 explicit PepperBroker(PluginModule* plugin_module);
50 49
51 // Decrements the references to the broker. 50 // Decrements the references to the broker.
52 // When there are no more references, this renderer's dispatcher is 51 // When there are no more references, this renderer's dispatcher is
53 // destroyed, allowing the broker to shutdown if appropriate. 52 // destroyed, allowing the broker to shutdown if appropriate.
54 // Callers should not reference this object after calling Disconnect(). 53 // Callers should not reference this object after calling Disconnect().
55 void Disconnect(PPB_Broker_Impl* client); 54 void Disconnect(PPB_Broker_Impl* client);
56 55
57 // Adds a pending connection to the broker. Balances out Disconnect() calls. 56 // Adds a pending connection to the broker. Balances out Disconnect() calls.
58 void AddPendingConnect(PPB_Broker_Impl* client); 57 void AddPendingConnect(PPB_Broker_Impl* client);
59 58
(...skipping 30 matching lines...) Expand all
90 // A map of pointers to objects that have requested a connection to the weak 89 // A map of pointers to objects that have requested a connection to the weak
91 // pointer we can use to reference them. The mapping is needed so we can clean 90 // pointer we can use to reference them. The mapping is needed so we can clean
92 // up entries for objects that may have been deleted. 91 // up entries for objects that may have been deleted.
93 typedef std::map<PPB_Broker_Impl*, PendingConnection> ClientMap; 92 typedef std::map<PPB_Broker_Impl*, PendingConnection> ClientMap;
94 ClientMap pending_connects_; 93 ClientMap pending_connects_;
95 94
96 // Pointer to the associated plugin module. 95 // Pointer to the associated plugin module.
97 // Always set and cleared at the same time as the module's pointer to this. 96 // Always set and cleared at the same time as the module's pointer to this.
98 PluginModule* plugin_module_; 97 PluginModule* plugin_module_;
99 98
100 base::WeakPtr<PepperHelperImpl> helper_;
101
102 DISALLOW_COPY_AND_ASSIGN(PepperBroker); 99 DISALLOW_COPY_AND_ASSIGN(PepperBroker);
103 }; 100 };
104 101
105 } // namespace content 102 } // namespace content
106 103
107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_ 104 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698