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_SHARED_IMPL_TRACKER_BASE_H_ | 5 #ifndef PPAPI_SHARED_IMPL_TRACKER_BASE_H_ |
6 #define PPAPI_SHARED_IMPL_TRACKER_BASE_H_ | 6 #define PPAPI_SHARED_IMPL_TRACKER_BASE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
11 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
12 #include "ppapi/proxy/interface_id.h" | 12 #include "ppapi/proxy/interface_id.h" |
13 | 13 |
14 namespace ppapi { | 14 namespace ppapi { |
15 | 15 |
16 class FunctionGroupBase; | 16 class FunctionGroupBase; |
17 class ResourceObjectBase; | 17 class ResourceObjectBase; |
18 class Var; | 18 class VarTracker; |
19 | 19 |
20 // Tracks resource and function APIs, providing a mapping between ID and | 20 // Tracks resource and function APIs, providing a mapping between ID and |
21 // object. | 21 // object. |
22 // TODO(brettw) Eventually this should be one object with global tracking and | 22 // TODO(brettw) Eventually this should be one object with global tracking and |
23 // called "Tracker", and this would be used in both the plugin side of the | 23 // called "Tracker", and this would be used in both the plugin side of the |
24 // proxy as well as the implementation in the renderer. Currently, all this | 24 // proxy as well as the implementation in the renderer. Currently, all this |
25 // does is forward to the process-type-specific tracker to get the information. | 25 // does is forward to the process-type-specific tracker to get the information. |
26 // TODO(fischman/vrk): When brettw fixes the TODO above, fix the ugliness in | 26 // TODO(fischman/vrk): When brettw fixes the TODO above, fix the ugliness in |
27 // VideoDecoderImpl accordingly. | 27 // VideoDecoderImpl accordingly. |
28 class TrackerBase { | 28 class TrackerBase { |
(...skipping 14 matching lines...) Expand all Loading... |
43 | 43 |
44 // Returns the function object corresponding to the given ID, or NULL if | 44 // Returns the function object corresponding to the given ID, or NULL if |
45 // there isn't one. | 45 // there isn't one. |
46 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, | 46 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, |
47 pp::proxy::InterfaceID id) = 0; | 47 pp::proxy::InterfaceID id) = 0; |
48 | 48 |
49 // Returns the instance corresponding to the given resource, or 0 if the | 49 // Returns the instance corresponding to the given resource, or 0 if the |
50 // resource is invalid. | 50 // resource is invalid. |
51 virtual PP_Instance GetInstanceForResource(PP_Resource resource) = 0; | 51 virtual PP_Instance GetInstanceForResource(PP_Resource resource) = 0; |
52 | 52 |
53 // PP_Vars ------------------------------------------------------------------- | 53 virtual VarTracker* GetVarTracker() = 0; |
54 | |
55 // Adds a new var to the tracker, returning the new Var ID. | |
56 virtual int32 AddVar(Var* var) = 0; | |
57 | |
58 // Retrieves a var from the tracker, returning an empty scoped ptr on failure. | |
59 virtual scoped_refptr<Var> GetVar(int32 var_id) const = 0; | |
60 | |
61 virtual bool AddRefVar(int32 var_id) = 0; | |
62 virtual bool UnrefVar(int32 var_id) = 0; | |
63 }; | 54 }; |
64 | 55 |
65 } // namespace ppapi | 56 } // namespace ppapi |
66 | 57 |
67 #endif // PPAPI_SHARED_IMPL_TRACKER_BASE_H_ | 58 #endif // PPAPI_SHARED_IMPL_TRACKER_BASE_H_ |
OLD | NEW |