| 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_module.h" | 11 #include "ppapi/c/pp_module.h" |
| 12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
| 13 #include "ppapi/proxy/interface_id.h" | 13 #include "ppapi/proxy/interface_id.h" |
| 14 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 14 | 15 |
| 15 namespace ppapi { | 16 namespace ppapi { |
| 16 | 17 |
| 17 class FunctionGroupBase; | 18 class FunctionGroupBase; |
| 18 class ResourceTracker; | 19 class ResourceTracker; |
| 19 class VarTracker; | 20 class VarTracker; |
| 20 | 21 |
| 21 // Tracks resource and function APIs, providing a mapping between ID and | 22 // Tracks resource and function APIs, providing a mapping between ID and |
| 22 // object. | 23 // object. |
| 23 // TODO(brettw) Eventually this should be one object with global tracking and | 24 // TODO(brettw) Eventually this should be one object with global tracking and |
| 24 // called "Tracker", and this would be used in both the plugin side of the | 25 // called "Tracker", and this would be used in both the plugin side of the |
| 25 // proxy as well as the implementation in the renderer. Currently, all this | 26 // proxy as well as the implementation in the renderer. Currently, all this |
| 26 // does is forward to the process-type-specific tracker to get the information. | 27 // does is forward to the process-type-specific tracker to get the information. |
| 27 // TODO(fischman/vrk): When brettw fixes the TODO above, fix the ugliness in | 28 // TODO(fischman/vrk): When brettw fixes the TODO above, fix the ugliness in |
| 28 // VideoDecoderImpl accordingly. | 29 // VideoDecoderImpl accordingly. |
| 29 class TrackerBase { | 30 class PPAPI_SHARED_EXPORT TrackerBase { |
| 30 public: | 31 public: |
| 31 // Must be called before any other function that uses the TrackerBase. | 32 // Must be called before any other function that uses the TrackerBase. |
| 32 // This sets the getter that returns the global implmenetation of | 33 // This sets the getter that returns the global implmenetation of |
| 33 // TrackerBase. It will be different for in the renderer and in the plugin | 34 // TrackerBase. It will be different for in the renderer and in the plugin |
| 34 // process. | 35 // process. |
| 35 static void Init(TrackerBase*(*getter)()); | 36 static void Init(TrackerBase*(*getter)()); |
| 36 | 37 |
| 37 // Retrieves the global tracker. This will be NULL if you haven't called | 38 // Retrieves the global tracker. This will be NULL if you haven't called |
| 38 // Init() first (it should be unnecessary to NULL-check this). | 39 // Init() first (it should be unnecessary to NULL-check this). |
| 39 static TrackerBase* Get(); | 40 static TrackerBase* Get(); |
| 40 | 41 |
| 41 // Returns the function object corresponding to the given ID, or NULL if | 42 // Returns the function object corresponding to the given ID, or NULL if |
| 42 // there isn't one. | 43 // there isn't one. |
| 43 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, | 44 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, |
| 44 proxy::InterfaceID id) = 0; | 45 proxy::InterfaceID id) = 0; |
| 45 | 46 |
| 46 virtual VarTracker* GetVarTracker() = 0; | 47 virtual VarTracker* GetVarTracker() = 0; |
| 47 virtual ResourceTracker* GetResourceTracker() = 0; | 48 virtual ResourceTracker* GetResourceTracker() = 0; |
| 48 | 49 |
| 49 // Returns the PP_Module associated with the given PP_Instance, or 0 on | 50 // Returns the PP_Module associated with the given PP_Instance, or 0 on |
| 50 // failure. | 51 // failure. |
| 51 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; | 52 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace ppapi | 55 } // namespace ppapi |
| 55 | 56 |
| 56 #endif // PPAPI_SHARED_IMPL_TRACKER_BASE_H_ | 57 #endif // PPAPI_SHARED_IMPL_TRACKER_BASE_H_ |
| OLD | NEW |