| 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 { |
| 24 |
| 25 namespace shared_impl { |
| 26 class WebKitForwarding; |
| 27 } |
| 28 |
| 22 namespace proxy { | 29 namespace proxy { |
| 23 | 30 |
| 24 class VarSerializationRules; | 31 class VarSerializationRules; |
| 25 | 32 |
| 26 // An interface proxy can represent either end of a cross-process interface | 33 // An interface proxy can represent either end of a cross-process interface |
| 27 // call. The "source" side is where the call is invoked, and the "target" side | 34 // call. The "source" side is where the call is invoked, and the "target" side |
| 28 // is where the call ends up being executed. | 35 // is where the call ends up being executed. |
| 29 // | 36 // |
| 30 // Plugin side | Browser side | 37 // Plugin side | Browser side |
| 31 // -------------------------------------|-------------------------------------- | 38 // -------------------------------------|-------------------------------------- |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 typedef int32_t (*InitModuleFunc)(PP_Module, GetInterfaceFunc); | 50 typedef int32_t (*InitModuleFunc)(PP_Module, GetInterfaceFunc); |
| 44 | 51 |
| 45 class Delegate : public ProxyChannel::Delegate { | 52 class Delegate : public ProxyChannel::Delegate { |
| 46 public: | 53 public: |
| 47 // Returns the set used for globally uniquifying PP_Instances. This same | 54 // 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 | 55 // 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. | 56 // plugin side, for the host side, the return value may be NULL. |
| 50 // | 57 // |
| 51 // DEREFERENCE ONLY ON THE I/O THREAD. | 58 // DEREFERENCE ONLY ON THE I/O THREAD. |
| 52 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() = 0; | 59 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() = 0; |
| 60 |
| 61 // Returns the WebKit forwarding object used to make calls into WebKit. |
| 62 // Necessary only on the plugin side. The host side can return NULL. |
| 63 virtual pp::shared_impl::WebKitForwarding* GetWebKitForwarding() = 0; |
| 64 |
| 65 // Posts the given task to the WebKit thread associated with this plugin |
| 66 // process. For host processes, this will not be called and can do |
| 67 // nothing. The WebKit thread should be lazily created if it does not |
| 68 // exist yet. |
| 69 virtual void PostToWebKitThread(const tracked_objects::Location& from_here, |
| 70 const base::Closure& task) = 0; |
| 53 }; | 71 }; |
| 54 | 72 |
| 55 virtual ~Dispatcher(); | 73 virtual ~Dispatcher(); |
| 56 | 74 |
| 57 // Returns true if the dispatcher is on the plugin side, or false if it's the | 75 // Returns true if the dispatcher is on the plugin side, or false if it's the |
| 58 // browser side. | 76 // browser side. |
| 59 virtual bool IsPlugin() const = 0; | 77 virtual bool IsPlugin() const = 0; |
| 60 | 78 |
| 61 VarSerializationRules* serialization_rules() const { | 79 VarSerializationRules* serialization_rules() const { |
| 62 return serialization_rules_.get(); | 80 return serialization_rules_.get(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 InterfaceID id); | 115 InterfaceID id); |
| 98 static const InterfaceProxy::Info* GetPPPInterfaceInfo( | 116 static const InterfaceProxy::Info* GetPPPInterfaceInfo( |
| 99 const std::string& name); | 117 const std::string& name); |
| 100 static const InterfaceProxy::Info* GetPPPInterfaceInfo( | 118 static const InterfaceProxy::Info* GetPPPInterfaceInfo( |
| 101 InterfaceID id); | 119 InterfaceID id); |
| 102 | 120 |
| 103 protected: | 121 protected: |
| 104 Dispatcher(base::ProcessHandle remote_process_handle, | 122 Dispatcher(base::ProcessHandle remote_process_handle, |
| 105 GetInterfaceFunc local_get_interface); | 123 GetInterfaceFunc local_get_interface); |
| 106 | 124 |
| 125 void SetDelegate(Delegate* delegate); |
| 126 |
| 107 // Setter for the derived classes to set the appropriate var serialization. | 127 // Setter for the derived classes to set the appropriate var serialization. |
| 108 // Takes ownership of the given pointer, which must be on the heap. | 128 // Takes ownership of the given pointer, which must be on the heap. |
| 109 void SetSerializationRules(VarSerializationRules* var_serialization_rules); | 129 void SetSerializationRules(VarSerializationRules* var_serialization_rules); |
| 110 | 130 |
| 111 bool disallow_trusted_interfaces() const { | 131 bool disallow_trusted_interfaces() const { |
| 112 return disallow_trusted_interfaces_; | 132 return disallow_trusted_interfaces_; |
| 113 } | 133 } |
| 114 | 134 |
| 135 Delegate* dispatcher_delegate_; |
| 136 |
| 115 private: | 137 private: |
| 116 bool disallow_trusted_interfaces_; | 138 bool disallow_trusted_interfaces_; |
| 117 | 139 |
| 118 GetInterfaceFunc local_get_interface_; | 140 GetInterfaceFunc local_get_interface_; |
| 119 | 141 |
| 120 CallbackTracker callback_tracker_; | 142 CallbackTracker callback_tracker_; |
| 121 | 143 |
| 122 scoped_ptr<VarSerializationRules> serialization_rules_; | 144 scoped_ptr<VarSerializationRules> serialization_rules_; |
| 123 | 145 |
| 124 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 146 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 125 }; | 147 }; |
| 126 | 148 |
| 127 } // namespace proxy | 149 } // namespace proxy |
| 128 } // namespace pp | 150 } // namespace pp |
| 129 | 151 |
| 130 #endif // PPAPI_PROXY_DISPATCHER_H_ | 152 #endif // PPAPI_PROXY_DISPATCHER_H_ |
| OLD | NEW |