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_PPB_TESTING_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_TESTING_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_TESTING_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_TESTING_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.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 PP_Point; | 14 struct PP_Point; |
15 struct PPB_Testing_Dev; | 15 struct PPB_Testing_Dev; |
16 | 16 |
17 namespace ppapi { | 17 namespace ppapi { |
18 namespace proxy { | 18 namespace proxy { |
19 | 19 |
20 class PPB_Testing_Proxy : public InterfaceProxy { | 20 class PPB_Testing_Proxy : public InterfaceProxy { |
21 public: | 21 public: |
22 PPB_Testing_Proxy(Dispatcher* dispatcher, const void* target_interface); | 22 PPB_Testing_Proxy(Dispatcher* dispatcher); |
23 virtual ~PPB_Testing_Proxy(); | 23 virtual ~PPB_Testing_Proxy(); |
24 | 24 |
25 static const Info* GetInfo(); | 25 static const Info* GetInfo(); |
26 | 26 |
27 const PPB_Testing_Dev* ppb_testing_target() const { | |
28 return static_cast<const PPB_Testing_Dev*>(target_interface()); | |
29 } | |
30 | |
31 // InterfaceProxy implementation. | 27 // InterfaceProxy implementation. |
32 virtual bool OnMessageReceived(const IPC::Message& msg); | 28 virtual bool OnMessageReceived(const IPC::Message& msg); |
33 | 29 |
34 private: | 30 private: |
35 // Message handlers. | 31 // Message handlers. |
36 void OnMsgReadImageData(const ppapi::HostResource& device_context_2d, | 32 void OnMsgReadImageData(const ppapi::HostResource& device_context_2d, |
37 const ppapi::HostResource& image, | 33 const ppapi::HostResource& image, |
38 const PP_Point& top_left, | 34 const PP_Point& top_left, |
39 PP_Bool* result); | 35 PP_Bool* result); |
40 void OnMsgRunMessageLoop(PP_Instance instance); | 36 void OnMsgRunMessageLoop(PP_Instance instance); |
41 void OnMsgQuitMessageLoop(PP_Instance instance); | 37 void OnMsgQuitMessageLoop(PP_Instance instance); |
42 void OnMsgGetLiveObjectsForInstance(PP_Instance instance, uint32_t* result); | 38 void OnMsgGetLiveObjectsForInstance(PP_Instance instance, uint32_t* result); |
43 | 39 |
| 40 // When this proxy is in the host side, this value caches the interface |
| 41 // pointer so we don't have to retrieve it from the dispatcher each time. |
| 42 // In the plugin, this value is always NULL. |
| 43 const PPB_Testing_Dev* ppb_testing_impl_; |
| 44 |
44 DISALLOW_COPY_AND_ASSIGN(PPB_Testing_Proxy); | 45 DISALLOW_COPY_AND_ASSIGN(PPB_Testing_Proxy); |
45 }; | 46 }; |
46 | 47 |
47 } // namespace proxy | 48 } // namespace proxy |
48 } // namespace ppapi | 49 } // namespace ppapi |
49 | 50 |
50 #endif // PPAPI_PROXY_PPB_TESTING_PROXY_H_ | 51 #endif // PPAPI_PROXY_PPB_TESTING_PROXY_H_ |
OLD | NEW |