Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: ppapi/proxy/plugin_resource_tracker.h

Issue 7623018: Move host resource from the proxy to the shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/plugin_resource.cc ('k') | ppapi/proxy/plugin_resource_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler_specific.h"
12 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_stdint.h" 14 #include "ppapi/c/pp_stdint.h"
15 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_var.h" 16 #include "ppapi/c/pp_var.h"
17 #include "ppapi/proxy/host_resource.h"
18 #include "ppapi/proxy/plugin_var_tracker.h" 17 #include "ppapi/proxy/plugin_var_tracker.h"
18 #include "ppapi/shared_impl/host_resource.h"
19 #include "ppapi/shared_impl/tracker_base.h" 19 #include "ppapi/shared_impl/tracker_base.h"
20 20
21 template<typename T> struct DefaultSingletonTraits; 21 template<typename T> struct DefaultSingletonTraits;
22 22
23 namespace ppapi { 23 namespace ppapi {
24 class Var; 24 class Var;
25 } 25 }
26 26
27 namespace pp { 27 namespace pp {
28 namespace proxy { 28 namespace proxy {
(...skipping 23 matching lines...) Expand all
52 // 52 //
53 // The resource tracker will take a reference to the given object. 53 // The resource tracker will take a reference to the given object.
54 PP_Resource AddResource(PluginResource* object); 54 PP_Resource AddResource(PluginResource* object);
55 55
56 void AddRefResource(PP_Resource resource); 56 void AddRefResource(PP_Resource resource);
57 void ReleaseResource(PP_Resource resource); 57 void ReleaseResource(PP_Resource resource);
58 58
59 // Given a host resource, maps it to an existing plugin resource ID if it 59 // Given a host resource, maps it to an existing plugin resource ID if it
60 // exists, or returns 0 on failure. 60 // exists, or returns 0 on failure.
61 PP_Resource PluginResourceForHostResource( 61 PP_Resource PluginResourceForHostResource(
62 const HostResource& resource) const; 62 const ppapi::HostResource& resource) const;
63 63
64 PluginVarTracker& var_tracker() { 64 PluginVarTracker& var_tracker() {
65 return var_tracker_test_override_ ? *var_tracker_test_override_ 65 return var_tracker_test_override_ ? *var_tracker_test_override_
66 : var_tracker_; 66 : var_tracker_;
67 } 67 }
68 68
69 void set_var_tracker_test_override(PluginVarTracker* t) { 69 void set_var_tracker_test_override(PluginVarTracker* t) {
70 var_tracker_test_override_ = t; 70 var_tracker_test_override_ = t;
71 } 71 }
72 72
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // Non-owning pointer to a var tracker mock used by tests. NULL when no 112 // Non-owning pointer to a var tracker mock used by tests. NULL when no
113 // test implementation is provided. 113 // test implementation is provided.
114 PluginVarTracker* var_tracker_test_override_; 114 PluginVarTracker* var_tracker_test_override_;
115 115
116 // Map of plugin resource IDs to the information tracking that resource. 116 // Map of plugin resource IDs to the information tracking that resource.
117 typedef std::map<PP_Resource, ResourceInfo> ResourceMap; 117 typedef std::map<PP_Resource, ResourceInfo> ResourceMap;
118 ResourceMap resource_map_; 118 ResourceMap resource_map_;
119 119
120 // Map of host instance/resource pairs to a plugin resource ID. 120 // Map of host instance/resource pairs to a plugin resource ID.
121 typedef std::map<HostResource, PP_Resource> HostResourceMap; 121 typedef std::map<ppapi::HostResource, PP_Resource> HostResourceMap;
122 HostResourceMap host_resource_map_; 122 HostResourceMap host_resource_map_;
123 123
124 // Tracks the last ID we've sent out as a plugin resource so we don't send 124 // Tracks the last ID we've sent out as a plugin resource so we don't send
125 // duplicates. 125 // duplicates.
126 PP_Resource last_resource_id_; 126 PP_Resource last_resource_id_;
127 127
128 DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker); 128 DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker);
129 }; 129 };
130 130
131 } // namespace proxy 131 } // namespace proxy
132 } // namespace pp 132 } // namespace pp
133 133
134 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ 134 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource.cc ('k') | ppapi/proxy/plugin_resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698