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 ResourceTracker; |
18 class VarTracker; | 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 { |
29 public: | 29 public: |
30 // Must be called before any other function that uses the TrackerBase. | 30 // Must be called before any other function that uses the TrackerBase. |
31 // This sets the getter that returns the global implmenetation of | 31 // This sets the getter that returns the global implmenetation of |
32 // TrackerBase. It will be different for in the renderer and in the plugin | 32 // TrackerBase. It will be different for in the renderer and in the plugin |
33 // process. | 33 // process. |
34 static void Init(TrackerBase*(*getter)()); | 34 static void Init(TrackerBase*(*getter)()); |
35 | 35 |
36 // Retrieves the global tracker. This will be NULL if you haven't called | 36 // Retrieves the global tracker. This will be NULL if you haven't called |
37 // Init() first (it should be unnecessary to NULL-check this). | 37 // Init() first (it should be unnecessary to NULL-check this). |
38 static TrackerBase* Get(); | 38 static TrackerBase* Get(); |
39 | 39 |
40 // Returns the resource object corresponding to the given ID, or NULL if | |
41 // there isn't one. | |
42 virtual ResourceObjectBase* GetResourceAPI(PP_Resource res) = 0; | |
43 | |
44 // Returns the function object corresponding to the given ID, or NULL if | 40 // Returns the function object corresponding to the given ID, or NULL if |
45 // there isn't one. | 41 // there isn't one. |
46 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, | 42 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, |
47 pp::proxy::InterfaceID id) = 0; | 43 pp::proxy::InterfaceID id) = 0; |
48 | 44 |
49 // Returns the instance corresponding to the given resource, or 0 if the | |
50 // resource is invalid. | |
51 virtual PP_Instance GetInstanceForResource(PP_Resource resource) = 0; | |
52 | |
53 virtual VarTracker* GetVarTracker() = 0; | 45 virtual VarTracker* GetVarTracker() = 0; |
| 46 virtual ResourceTracker* GetResourceTracker() = 0; |
54 }; | 47 }; |
55 | 48 |
56 } // namespace ppapi | 49 } // namespace ppapi |
57 | 50 |
58 #endif // PPAPI_SHARED_IMPL_TRACKER_BASE_H_ | 51 #endif // PPAPI_SHARED_IMPL_TRACKER_BASE_H_ |
OLD | NEW |