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_PPP_INSTANCE_PRIVATE_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPP_INSTANCE_PRIVATE_PROXY_H_ |
6 #define PPAPI_PROXY_PPP_INSTANCE_PRIVATE_PROXY_H_ | 6 #define PPAPI_PROXY_PPP_INSTANCE_PRIVATE_PROXY_H_ |
7 | 7 |
8 #include "ppapi/c/pp_instance.h" | 8 #include "ppapi/c/pp_instance.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/proxy/interface_proxy.h" | 11 #include "ppapi/proxy/interface_proxy.h" |
12 #include "ppapi/shared_impl/host_resource.h" | 12 #include "ppapi/shared_impl/host_resource.h" |
13 | 13 |
14 struct PPP_Instance_Private; | 14 struct PPP_Instance_Private; |
15 | 15 |
16 namespace ppapi { | 16 namespace ppapi { |
17 namespace proxy { | 17 namespace proxy { |
18 | 18 |
19 class SerializedVarReturnValue; | 19 class SerializedVarReturnValue; |
20 | 20 |
21 class PPP_Instance_Private_Proxy : public InterfaceProxy { | 21 class PPP_Instance_Private_Proxy : public InterfaceProxy { |
22 public: | 22 public: |
23 PPP_Instance_Private_Proxy(Dispatcher* dispatcher, | 23 PPP_Instance_Private_Proxy(Dispatcher* dispatcher); |
24 const void* target_interface); | |
25 virtual ~PPP_Instance_Private_Proxy(); | 24 virtual ~PPP_Instance_Private_Proxy(); |
26 | 25 |
27 static const Info* GetInfo(); | 26 static const Info* GetInfo(); |
28 | 27 |
29 const PPP_Instance_Private* ppp_instance_private_target() const { | |
30 return reinterpret_cast<const PPP_Instance_Private*>(target_interface()); | |
31 } | |
32 | |
33 private: | 28 private: |
34 // InterfaceProxy implementation. | 29 // InterfaceProxy implementation. |
35 virtual bool OnMessageReceived(const IPC::Message& msg); | 30 virtual bool OnMessageReceived(const IPC::Message& msg); |
36 | 31 |
37 // Message handlers. | 32 // Message handlers. |
38 void OnMsgGetInstanceObject(PP_Instance instance, | 33 void OnMsgGetInstanceObject(PP_Instance instance, |
39 SerializedVarReturnValue result); | 34 SerializedVarReturnValue result); |
| 35 |
| 36 // When this proxy is in the plugin side, this value caches the interface |
| 37 // pointer so we don't have to retrieve it from the dispatcher each time. |
| 38 // In the host, this value is always NULL. |
| 39 const PPP_Instance_Private* ppp_instance_private_impl_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Private_Proxy); |
40 }; | 42 }; |
41 | 43 |
42 } // namespace proxy | 44 } // namespace proxy |
43 } // namespace ppapi | 45 } // namespace ppapi |
44 | 46 |
45 #endif // PPAPI_PROXY_PPP_INSTANCE_PRIVATE_PROXY_H_ | 47 #endif // PPAPI_PROXY_PPP_INSTANCE_PRIVATE_PROXY_H_ |
OLD | NEW |