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_RESOURCE_TRACKER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ |
6 #define PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ | 6 #define PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
| 11 #include "base/compiler_specific.h" |
11 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
15 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/pp_var.h" | 17 #include "ppapi/c/pp_var.h" |
17 #include "ppapi/proxy/host_resource.h" | 18 #include "ppapi/proxy/host_resource.h" |
18 #include "ppapi/shared_impl/tracker_base.h" | 19 #include "ppapi/shared_impl/tracker_base.h" |
19 | 20 |
20 template<typename T> struct DefaultSingletonTraits; | 21 template<typename T> struct DefaultSingletonTraits; |
(...skipping 28 matching lines...) Expand all Loading... |
49 void AddRefResource(PP_Resource resource); | 50 void AddRefResource(PP_Resource resource); |
50 void ReleaseResource(PP_Resource resource); | 51 void ReleaseResource(PP_Resource resource); |
51 | 52 |
52 // Given a host resource, maps it to an existing plugin resource ID if it | 53 // Given a host resource, maps it to an existing plugin resource ID if it |
53 // exists, or returns 0 on failure. | 54 // exists, or returns 0 on failure. |
54 PP_Resource PluginResourceForHostResource( | 55 PP_Resource PluginResourceForHostResource( |
55 const HostResource& resource) const; | 56 const HostResource& resource) const; |
56 | 57 |
57 // TrackerBase. | 58 // TrackerBase. |
58 virtual ::ppapi::ResourceObjectBase* GetResourceAPI( | 59 virtual ::ppapi::ResourceObjectBase* GetResourceAPI( |
59 PP_Resource res); | 60 PP_Resource res) OVERRIDE; |
60 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI( | 61 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI( |
61 PP_Instance inst, | 62 PP_Instance inst, |
62 pp::proxy::InterfaceID id); | 63 pp::proxy::InterfaceID id) OVERRIDE; |
| 64 virtual PP_Instance GetInstanceForResource(PP_Resource resource) OVERRIDE; |
63 | 65 |
64 private: | 66 private: |
65 friend struct DefaultSingletonTraits<PluginResourceTracker>; | 67 friend struct DefaultSingletonTraits<PluginResourceTracker>; |
66 friend class PluginResourceTrackerTest; | 68 friend class PluginResourceTrackerTest; |
67 friend class PluginProxyTest; | 69 friend class PluginProxyTest; |
68 | 70 |
69 PluginResourceTracker(); | 71 PluginResourceTracker(); |
70 ~PluginResourceTracker(); | 72 ~PluginResourceTracker(); |
71 | 73 |
72 struct ResourceInfo { | 74 struct ResourceInfo { |
(...skipping 23 matching lines...) Expand all Loading... |
96 // duplicates. | 98 // duplicates. |
97 PP_Resource last_resource_id_; | 99 PP_Resource last_resource_id_; |
98 | 100 |
99 DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker); | 101 DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker); |
100 }; | 102 }; |
101 | 103 |
102 } // namespace proxy | 104 } // namespace proxy |
103 } // namespace pp | 105 } // namespace pp |
104 | 106 |
105 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ | 107 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ |
OLD | NEW |