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