| 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_PLUGIN_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/process.h" | 12 #include "base/process.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "ppapi/c/pp_rect.h" | 14 #include "ppapi/c/pp_rect.h" |
| 15 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
| 16 #include "ppapi/proxy/dispatcher.h" | 16 #include "ppapi/proxy/dispatcher.h" |
| 17 #include "ppapi/shared_impl/function_group_base.h" |
| 17 | 18 |
| 18 class MessageLoop; | 19 class MessageLoop; |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class WaitableEvent; | 22 class WaitableEvent; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace pp { | 25 namespace pp { |
| 25 namespace proxy { | 26 namespace proxy { |
| 26 | 27 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // IPC::Channel::Listener implementation. | 65 // IPC::Channel::Listener implementation. |
| 65 virtual bool OnMessageReceived(const IPC::Message& msg); | 66 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 66 virtual void OnChannelError(); | 67 virtual void OnChannelError(); |
| 67 | 68 |
| 68 // Keeps track of which dispatcher to use for each instance, active instances | 69 // Keeps track of which dispatcher to use for each instance, active instances |
| 69 // and tracks associated data like the current size. | 70 // and tracks associated data like the current size. |
| 70 void DidCreateInstance(PP_Instance instance); | 71 void DidCreateInstance(PP_Instance instance); |
| 71 void DidDestroyInstance(PP_Instance instance); | 72 void DidDestroyInstance(PP_Instance instance); |
| 72 | 73 |
| 73 // Gets the data for an existing instance, or NULL if the instance id doesn't | 74 // Gets the data for an existing instance, or NULL if the instance id doesn't |
| 74 // correspond to a known instance. | 75 // correspond to a known instance. |
| 75 InstanceData* GetInstanceData(PP_Instance instance); | 76 InstanceData* GetInstanceData(PP_Instance instance); |
| 76 | 77 |
| 78 // Returns the "new-style" function API for the given interface ID, creating |
| 79 // it if necessary. |
| 80 // TODO(brettw) this is in progress. It should be merged with the target |
| 81 // proxies so there is one list to consult. |
| 82 ::ppapi::shared_impl::FunctionGroupBase* GetFunctionAPI( |
| 83 pp::proxy::InterfaceID id); |
| 84 |
| 77 private: | 85 private: |
| 78 friend class PluginDispatcherTest; | 86 friend class PluginDispatcherTest; |
| 79 | 87 |
| 80 // Notifies all live instances that they're now closed. This is used when | 88 // Notifies all live instances that they're now closed. This is used when |
| 81 // a renderer crashes or some other error is received. | 89 // a renderer crashes or some other error is received. |
| 82 void ForceFreeAllInstances(); | 90 void ForceFreeAllInstances(); |
| 83 | 91 |
| 84 // IPC message handlers. | 92 // IPC message handlers. |
| 85 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); | 93 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); |
| 86 | 94 |
| 87 // All target proxies currently created. These are ones that receive | 95 // All target proxies currently created. These are ones that receive |
| 88 // messages. | 96 // messages. |
| 89 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; | 97 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; |
| 90 | 98 |
| 99 // Function proxies created for "new-style" FunctionGroups. |
| 100 // TODO(brettw) this is in progress. It should be merged with the target |
| 101 // proxies so there is one list to consult. |
| 102 scoped_ptr< ::ppapi::shared_impl::FunctionGroupBase > |
| 103 function_proxies_[INTERFACE_ID_COUNT]; |
| 104 |
| 91 typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap; | 105 typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap; |
| 92 InstanceDataMap instance_map_; | 106 InstanceDataMap instance_map_; |
| 93 | 107 |
| 94 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); | 108 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); |
| 95 }; | 109 }; |
| 96 | 110 |
| 97 } // namespace proxy | 111 } // namespace proxy |
| 98 } // namespace pp | 112 } // namespace pp |
| 99 | 113 |
| 100 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 114 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
| OLD | NEW |