Refactor android test results logging.
[chromium-blink-merge.git] / ppapi / proxy / plugin_resource_tracker.h
blob6bed72f4eff776687c6d1d2acea988c0ebcd33ec
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_
6 #define PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_
8 #include <map>
9 #include <utility>
11 #include "base/compiler_specific.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_stdint.h"
15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_var.h"
17 #include "ppapi/proxy/ppapi_proxy_export.h"
18 #include "ppapi/shared_impl/host_resource.h"
19 #include "ppapi/shared_impl/resource_tracker.h"
21 template<typename T> struct DefaultSingletonTraits;
23 namespace ppapi {
25 namespace proxy {
27 class PPAPI_PROXY_EXPORT PluginResourceTracker : public ResourceTracker {
28 public:
29 PluginResourceTracker();
30 virtual ~PluginResourceTracker();
32 // Given a host resource, maps it to an existing plugin resource ID if it
33 // exists, or returns 0 on failure.
34 PP_Resource PluginResourceForHostResource(
35 const HostResource& resource) const;
37 protected:
38 // ResourceTracker overrides.
39 virtual PP_Resource AddResource(Resource* object) OVERRIDE;
40 virtual void RemoveResource(Resource* object) OVERRIDE;
42 private:
43 // Map of host instance/resource pairs to a plugin resource ID.
44 typedef std::map<HostResource, PP_Resource> HostResourceMap;
45 HostResourceMap host_resource_map_;
47 DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker);
50 } // namespace proxy
51 } // namespace ppapi
53 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_