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_PPB_CORE_PROXY_H_ | 5 #ifndef PPAPI_PPB_CORE_PROXY_H_ |
6 #define PPAPI_PPB_CORE_PROXY_H_ | 6 #define PPAPI_PPB_CORE_PROXY_H_ |
7 | 7 |
8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
| 11 #include "ppapi/c/ppb_core.h" |
11 #include "ppapi/proxy/interface_proxy.h" | 12 #include "ppapi/proxy/interface_proxy.h" |
12 #include "ppapi/shared_impl/host_resource.h" | 13 #include "ppapi/shared_impl/host_resource.h" |
13 | 14 |
14 struct PPB_Core; | 15 struct PPB_Core; |
15 | 16 |
16 namespace ppapi { | 17 namespace ppapi { |
17 namespace proxy { | 18 namespace proxy { |
18 | 19 |
19 class PPB_Core_Proxy : public InterfaceProxy { | 20 class PPB_Core_Proxy : public InterfaceProxy { |
20 public: | 21 public: |
21 PPB_Core_Proxy(Dispatcher* dispatcher, const void* target_interface); | 22 PPB_Core_Proxy(Dispatcher* dispatcher); |
22 virtual ~PPB_Core_Proxy(); | 23 virtual ~PPB_Core_Proxy(); |
23 | 24 |
24 static const Info* GetInfo(); | 25 static const PPB_Core* GetPPB_Core_Interface(); |
25 | |
26 const PPB_Core* ppb_core_target() const { | |
27 return reinterpret_cast<const PPB_Core*>(target_interface()); | |
28 } | |
29 | 26 |
30 // InterfaceProxy implementation. | 27 // InterfaceProxy implementation. |
31 virtual bool OnMessageReceived(const IPC::Message& msg); | 28 virtual bool OnMessageReceived(const IPC::Message& msg); |
32 | 29 |
| 30 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_CORE; |
| 31 |
33 private: | 32 private: |
34 // Message handlers. | 33 // Message handlers. |
35 void OnMsgAddRefResource(const ppapi::HostResource& resource); | 34 void OnMsgAddRefResource(const ppapi::HostResource& resource); |
36 void OnMsgReleaseResource(const ppapi::HostResource& resource); | 35 void OnMsgReleaseResource(const ppapi::HostResource& resource); |
| 36 |
| 37 // When this proxy is in the host side, this value caches the interface |
| 38 // pointer so we don't have to retrieve it from the dispatcher each time. |
| 39 // In the plugin, this value is always NULL. |
| 40 const PPB_Core* ppb_core_impl_; |
37 }; | 41 }; |
38 | 42 |
39 } // namespace proxy | 43 } // namespace proxy |
40 } // namespace ppapi | 44 } // namespace ppapi |
41 | 45 |
42 #endif // PPAPI_PPB_CORE_PROXY_H_ | 46 #endif // PPAPI_PPB_CORE_PROXY_H_ |
OLD | NEW |