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

Side by Side Diff: ppapi/shared_impl/resource_tracker.h

Issue 1649623002: Update ppapi to not use linked_ptr or ScopedVector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mark RawVarDataGraph as DISALLOW_COPY_AND_ASSIGN Created 4 years, 10 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
« no previous file with comments | « ppapi/proxy/raw_var_data.cc ('k') | ppapi/shared_impl/resource_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RESOURCE_TRACKER_H_ 5 #ifndef PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_
6 #define PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_ 6 #define PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
17 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
18 #include "base/threading/thread_checker_impl.h" 17 #include "base/threading/thread_checker_impl.h"
19 #include "ppapi/c/pp_instance.h" 18 #include "ppapi/c/pp_instance.h"
20 #include "ppapi/c/pp_resource.h" 19 #include "ppapi/c/pp_resource.h"
21 #include "ppapi/shared_impl/ppapi_shared_export.h" 20 #include "ppapi/shared_impl/ppapi_shared_export.h"
22 21
23 namespace ppapi { 22 namespace ppapi {
24 23
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool CanOperateOnResource(PP_Resource res); 99 bool CanOperateOnResource(PP_Resource res);
101 100
102 typedef std::set<PP_Resource> ResourceSet; 101 typedef std::set<PP_Resource> ResourceSet;
103 102
104 struct InstanceData { 103 struct InstanceData {
105 // Lists all resources associated with the given instance as non-owning 104 // Lists all resources associated with the given instance as non-owning
106 // pointers. This allows us to notify those resources that the instance is 105 // pointers. This allows us to notify those resources that the instance is
107 // going away (otherwise, they may crash if they outlive the instance). 106 // going away (otherwise, they may crash if they outlive the instance).
108 ResourceSet resources; 107 ResourceSet resources;
109 }; 108 };
110 typedef base::hash_map<PP_Instance, linked_ptr<InstanceData> > InstanceMap; 109 typedef base::hash_map<PP_Instance, scoped_ptr<InstanceData>> InstanceMap;
111 110
112 InstanceMap instance_map_; 111 InstanceMap instance_map_;
113 112
114 // For each PP_Resource, keep the object pointer and a plugin use count. 113 // For each PP_Resource, keep the object pointer and a plugin use count.
115 // This use count is different then Resource object's RefCount, and is 114 // This use count is different then Resource object's RefCount, and is
116 // manipulated using this AddRefResource/UnrefResource. When the plugin use 115 // manipulated using this AddRefResource/UnrefResource. When the plugin use
117 // count is positive, we keep an extra ref on the Resource on 116 // count is positive, we keep an extra ref on the Resource on
118 // behalf of the plugin. When it drops to 0, we free that ref, keeping 117 // behalf of the plugin. When it drops to 0, we free that ref, keeping
119 // the resource in the list. 118 // the resource in the list.
120 // 119 //
(...skipping 11 matching lines...) Expand all
132 scoped_ptr<base::ThreadChecker> thread_checker_; 131 scoped_ptr<base::ThreadChecker> thread_checker_;
133 132
134 base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_; 133 base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_;
135 134
136 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); 135 DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
137 }; 136 };
138 137
139 } // namespace ppapi 138 } // namespace ppapi
140 139
141 #endif // PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_ 140 #endif // PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/raw_var_data.cc ('k') | ppapi/shared_impl/resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698