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_VAR_TRACKER_H_ | 5 #ifndef PPAPI_SHARED_IMPL_VAR_TRACKER_H_ |
6 #define PPAPI_SHARED_IMPL_VAR_TRACKER_H_ | 6 #define PPAPI_SHARED_IMPL_VAR_TRACKER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
| 12 #include "ppapi/shared_impl/ppapi_shared_export.h" |
12 | 13 |
13 namespace ppapi { | 14 namespace ppapi { |
14 | 15 |
15 class Var; | 16 class Var; |
16 | 17 |
17 // Tracks non-POD (refcounted) var objects held by a plugin. | 18 // Tracks non-POD (refcounted) var objects held by a plugin. |
18 // | 19 // |
19 // The tricky part is the concept of a "tracked object". These are only | 20 // The tricky part is the concept of a "tracked object". These are only |
20 // necessary in the plugin side of the proxy when running out of process. A | 21 // necessary in the plugin side of the proxy when running out of process. A |
21 // tracked object is one that the plugin is aware of, but doesn't hold a | 22 // tracked object is one that the plugin is aware of, but doesn't hold a |
22 // reference to. This will happen when the plugin is passed an object as an | 23 // reference to. This will happen when the plugin is passed an object as an |
23 // argument from the host (renderer) as an input argument to a sync function, | 24 // argument from the host (renderer) as an input argument to a sync function, |
24 // but where ownership is not passed. | 25 // but where ownership is not passed. |
25 // | 26 // |
26 // This class maintains the "track_with_no_reference_count" but doesn't do | 27 // This class maintains the "track_with_no_reference_count" but doesn't do |
27 // anything with it other than call virtual functions. The interesting parts | 28 // anything with it other than call virtual functions. The interesting parts |
28 // are added by the PluginObjectVar derived from this class. | 29 // are added by the PluginObjectVar derived from this class. |
29 class VarTracker { | 30 class PPAPI_SHARED_EXPORT VarTracker { |
30 public: | 31 public: |
31 VarTracker(); | 32 VarTracker(); |
32 virtual ~VarTracker(); | 33 virtual ~VarTracker(); |
33 | 34 |
34 // Called by the Var object to add a new var to the tracker. | 35 // Called by the Var object to add a new var to the tracker. |
35 int32 AddVar(Var* var); | 36 int32 AddVar(Var* var); |
36 | 37 |
37 // Looks up a given var and returns a reference to the Var if it exists. | 38 // Looks up a given var and returns a reference to the Var if it exists. |
38 // Returns NULL if the var type is not an object we track (POD) or is | 39 // Returns NULL if the var type is not an object we track (POD) or is |
39 // invalid. | 40 // invalid. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 125 |
125 // Last assigned var ID. | 126 // Last assigned var ID. |
126 int32 last_var_id_; | 127 int32 last_var_id_; |
127 | 128 |
128 DISALLOW_COPY_AND_ASSIGN(VarTracker); | 129 DISALLOW_COPY_AND_ASSIGN(VarTracker); |
129 }; | 130 }; |
130 | 131 |
131 } // namespace ppapi | 132 } // namespace ppapi |
132 | 133 |
133 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ | 134 #endif // PPAPI_SHARED_IMPL_VAR_TRACKER_H_ |
OLD | NEW |