Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Side by Side Diff: webkit/plugins/ppapi/host_var_tracker.h

Issue 9564024: Re-land http://codereview.chromium.org/9403039/, r124106 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary change to ppapi_uitest.cc timer_ Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/testing_instance.cc ('k') | webkit/plugins/ppapi/host_var_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_
6 #define WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_ 6 #define WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/hash_tables.h" 13 #include "base/hash_tables.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h"
17 #include "ppapi/c/pp_instance.h" 18 #include "ppapi/c/pp_instance.h"
18 #include "ppapi/c/pp_resource.h" 19 #include "ppapi/c/pp_resource.h"
19 #include "ppapi/shared_impl/function_group_base.h" 20 #include "ppapi/shared_impl/function_group_base.h"
20 #include "ppapi/shared_impl/resource_tracker.h" 21 #include "ppapi/shared_impl/resource_tracker.h"
21 #include "ppapi/shared_impl/var_tracker.h" 22 #include "ppapi/shared_impl/var_tracker.h"
22 #include "webkit/plugins/webkit_plugins_export.h" 23 #include "webkit/plugins/webkit_plugins_export.h"
23 24
24 typedef struct NPObject NPObject; 25 typedef struct NPObject NPObject;
25 26
26 namespace ppapi { 27 namespace ppapi {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 60
60 // Forcibly deletes all np object vars for the given instance. Used for 61 // Forcibly deletes all np object vars for the given instance. Used for
61 // instance cleanup. 62 // instance cleanup.
62 void ForceFreeNPObjectsForInstance(PP_Instance instance); 63 void ForceFreeNPObjectsForInstance(PP_Instance instance);
63 64
64 private: 65 private:
65 // VarTracker implementation. 66 // VarTracker implementation.
66 virtual ::ppapi::ArrayBufferVar* CreateArrayBuffer( 67 virtual ::ppapi::ArrayBufferVar* CreateArrayBuffer(
67 uint32 size_in_bytes) OVERRIDE; 68 uint32 size_in_bytes) OVERRIDE;
68 69
69 typedef std::map<NPObject*, ::ppapi::NPObjectVar*> NPObjectToNPObjectVarMap; 70 // Clear the reference count of the given object and remove it from
71 // live_vars_.
72 void ForceReleaseNPObject(const base::WeakPtr< ::ppapi::NPObjectVar>& object);
73
74 typedef std::map<NPObject*, base::WeakPtr< ::ppapi::NPObjectVar> >
75 NPObjectToNPObjectVarMap;
70 76
71 // Lists all known NPObjects, first indexed by the corresponding instance, 77 // Lists all known NPObjects, first indexed by the corresponding instance,
72 // then by the NPObject*. This allows us to look up an NPObjectVar given 78 // then by the NPObject*. This allows us to look up an NPObjectVar given
73 // these two pieces of information. 79 // these two pieces of information.
74 // 80 //
75 // The instance map is lazily managed, so we'll add the 81 // The instance map is lazily managed, so we'll add the
76 // NPObjectToNPObjectVarMap lazily when the first NPObject var is created, 82 // NPObjectToNPObjectVarMap lazily when the first NPObject var is created,
77 // and delete it when it's empty. 83 // and delete it when it's empty.
78 typedef std::map<PP_Instance, linked_ptr<NPObjectToNPObjectVarMap> > 84 typedef std::map<PP_Instance, linked_ptr<NPObjectToNPObjectVarMap> >
79 InstanceMap; 85 InstanceMap;
80 InstanceMap instance_map_; 86 InstanceMap instance_map_;
81 87
82 DISALLOW_COPY_AND_ASSIGN(HostVarTracker); 88 DISALLOW_COPY_AND_ASSIGN(HostVarTracker);
83 }; 89 };
84 90
85 } // namespace ppapi 91 } // namespace ppapi
86 } // namespace webkit 92 } // namespace webkit
87 93
88 #endif // WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_ 94 #endif // WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_
OLDNEW
« no previous file with comments | « ppapi/tests/testing_instance.cc ('k') | webkit/plugins/ppapi/host_var_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698