blob: b87c6f8e6aa8588a78f073fce0c28fd6c079de36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_
#define PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_
#include <map>
#include <utility>
#include "base/compiler_specific.h"
#include "base/synchronization/lock.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/resource_tracker.h"
template<typename T> struct DefaultSingletonTraits;
namespace ppapi {
class Var;
namespace proxy {
class PluginDispatcher;
class PPAPI_PROXY_EXPORT PluginResourceTracker : public ResourceTracker {
public:
PluginResourceTracker();
virtual ~PluginResourceTracker();
// Given a host resource, maps it to an existing plugin resource ID if it
// exists, or returns 0 on failure.
PP_Resource PluginResourceForHostResource(
const HostResource& resource) const;
protected:
// ResourceTracker overrides.
virtual PP_Resource AddResource(Resource* object) OVERRIDE;
virtual void RemoveResource(Resource* object) OVERRIDE;
private:
// Map of host instance/resource pairs to a plugin resource ID.
typedef std::map<HostResource, PP_Resource> HostResourceMap;
HostResourceMap host_resource_map_;
// The global lock for the plugin side of the proxy.
base::Lock proxy_lock_;
DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker);
};
} // namespace proxy
} // namespace ppapi
#endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_
|