Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 PPAPI_PROXY_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_DISPATCHER_H_ |
| 6 #define PPAPI_PROXY_DISPATCHER_H_ | 6 #define PPAPI_PROXY_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | |
| 13 #include "base/tracked_objects.h" | |
| 12 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
| 13 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_module.h" | 16 #include "ppapi/c/pp_module.h" |
| 15 #include "ppapi/proxy/callback_tracker.h" | 17 #include "ppapi/proxy/callback_tracker.h" |
| 16 #include "ppapi/proxy/proxy_channel.h" | 18 #include "ppapi/proxy/proxy_channel.h" |
| 17 #include "ppapi/proxy/interface_id.h" | 19 #include "ppapi/proxy/interface_id.h" |
| 18 #include "ppapi/proxy/interface_proxy.h" | 20 #include "ppapi/proxy/interface_proxy.h" |
| 19 #include "ppapi/proxy/plugin_var_tracker.h" | 21 #include "ppapi/proxy/plugin_var_tracker.h" |
| 20 | 22 |
| 21 namespace pp { | 23 namespace pp { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 43 typedef int32_t (*InitModuleFunc)(PP_Module, GetInterfaceFunc); | 45 typedef int32_t (*InitModuleFunc)(PP_Module, GetInterfaceFunc); |
| 44 | 46 |
| 45 class Delegate : public ProxyChannel::Delegate { | 47 class Delegate : public ProxyChannel::Delegate { |
| 46 public: | 48 public: |
| 47 // Returns the set used for globally uniquifying PP_Instances. This same | 49 // Returns the set used for globally uniquifying PP_Instances. This same |
| 48 // set must be returned for all channels. This is required only for the | 50 // set must be returned for all channels. This is required only for the |
| 49 // plugin side, for the host side, the return value may be NULL. | 51 // plugin side, for the host side, the return value may be NULL. |
| 50 // | 52 // |
| 51 // DEREFERENCE ONLY ON THE I/O THREAD. | 53 // DEREFERENCE ONLY ON THE I/O THREAD. |
| 52 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() = 0; | 54 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() = 0; |
| 55 | |
| 56 // Posts the given task to the WebKit thread associated with this plugin | |
| 57 // process. For host processes, this will not be called and can do | |
| 58 // nothing. The WebKit thread should be lazily created if it does not | |
| 59 // exist yet. | |
| 60 virtual void PostToWebKitThread(const tracked_objects::Location& from_here, | |
| 61 const base::Closure& task) = 0; | |
| 53 }; | 62 }; |
| 54 | 63 |
| 55 virtual ~Dispatcher(); | 64 virtual ~Dispatcher(); |
| 56 | 65 |
| 57 // Returns true if the dispatcher is on the plugin side, or false if it's the | 66 // Returns true if the dispatcher is on the plugin side, or false if it's the |
| 58 // browser side. | 67 // browser side. |
| 59 virtual bool IsPlugin() const = 0; | 68 virtual bool IsPlugin() const = 0; |
| 60 | 69 |
| 61 VarSerializationRules* serialization_rules() const { | 70 VarSerializationRules* serialization_rules() const { |
| 62 return serialization_rules_.get(); | 71 return serialization_rules_.get(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 InterfaceID id); | 106 InterfaceID id); |
| 98 static const InterfaceProxy::Info* GetPPPInterfaceInfo( | 107 static const InterfaceProxy::Info* GetPPPInterfaceInfo( |
| 99 const std::string& name); | 108 const std::string& name); |
| 100 static const InterfaceProxy::Info* GetPPPInterfaceInfo( | 109 static const InterfaceProxy::Info* GetPPPInterfaceInfo( |
| 101 InterfaceID id); | 110 InterfaceID id); |
| 102 | 111 |
| 103 protected: | 112 protected: |
| 104 Dispatcher(base::ProcessHandle remote_process_handle, | 113 Dispatcher(base::ProcessHandle remote_process_handle, |
| 105 GetInterfaceFunc local_get_interface); | 114 GetInterfaceFunc local_get_interface); |
| 106 | 115 |
| 116 void InitDispatcher(Delegate* delegate); | |
|
piman
2011/05/09 20:13:44
InitDispatcher->SetDelegate ?
| |
| 117 | |
| 107 // Setter for the derived classes to set the appropriate var serialization. | 118 // Setter for the derived classes to set the appropriate var serialization. |
| 108 // Takes ownership of the given pointer, which must be on the heap. | 119 // Takes ownership of the given pointer, which must be on the heap. |
| 109 void SetSerializationRules(VarSerializationRules* var_serialization_rules); | 120 void SetSerializationRules(VarSerializationRules* var_serialization_rules); |
| 110 | 121 |
| 111 bool disallow_trusted_interfaces() const { | 122 bool disallow_trusted_interfaces() const { |
| 112 return disallow_trusted_interfaces_; | 123 return disallow_trusted_interfaces_; |
| 113 } | 124 } |
| 114 | 125 |
| 126 Delegate* dispatcher_delegate_; | |
| 127 | |
| 115 private: | 128 private: |
| 116 bool disallow_trusted_interfaces_; | 129 bool disallow_trusted_interfaces_; |
| 117 | 130 |
| 118 GetInterfaceFunc local_get_interface_; | 131 GetInterfaceFunc local_get_interface_; |
| 119 | 132 |
| 120 CallbackTracker callback_tracker_; | 133 CallbackTracker callback_tracker_; |
| 121 | 134 |
| 122 scoped_ptr<VarSerializationRules> serialization_rules_; | 135 scoped_ptr<VarSerializationRules> serialization_rules_; |
| 123 | 136 |
| 124 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 137 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 125 }; | 138 }; |
| 126 | 139 |
| 127 } // namespace proxy | 140 } // namespace proxy |
| 128 } // namespace pp | 141 } // namespace pp |
| 129 | 142 |
| 130 #endif // PPAPI_PROXY_DISPATCHER_H_ | 143 #endif // PPAPI_PROXY_DISPATCHER_H_ |
| OLD | NEW |