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

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

Issue 1864293002: Convert //ppapi to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more nullptr Created 4 years, 8 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
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 #include "ppapi/shared_impl/resource_tracker.h" 5 #include "ppapi/shared_impl/resource_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
10 #include "ppapi/shared_impl/callback_tracker.h" 11 #include "ppapi/shared_impl/callback_tracker.h"
11 #include "ppapi/shared_impl/id_assignment.h" 12 #include "ppapi/shared_impl/id_assignment.h"
12 #include "ppapi/shared_impl/ppapi_globals.h" 13 #include "ppapi/shared_impl/ppapi_globals.h"
13 #include "ppapi/shared_impl/proxy_lock.h" 14 #include "ppapi/shared_impl/proxy_lock.h"
14 #include "ppapi/shared_impl/resource.h" 15 #include "ppapi/shared_impl/resource.h"
15 16
16 namespace ppapi { 17 namespace ppapi {
17 18
18 ResourceTracker::ResourceTracker(ThreadMode thread_mode) 19 ResourceTracker::ResourceTracker(ThreadMode thread_mode)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 90 }
90 } 91 }
91 92
92 void ResourceTracker::DidCreateInstance(PP_Instance instance) { 93 void ResourceTracker::DidCreateInstance(PP_Instance instance) {
93 CheckThreadingPreconditions(); 94 CheckThreadingPreconditions();
94 // Due to the infrastructure of some tests, the instance is registered 95 // Due to the infrastructure of some tests, the instance is registered
95 // twice in a few cases. It would be nice not to do that and assert here 96 // twice in a few cases. It would be nice not to do that and assert here
96 // instead. 97 // instead.
97 if (instance_map_.find(instance) != instance_map_.end()) 98 if (instance_map_.find(instance) != instance_map_.end())
98 return; 99 return;
99 instance_map_[instance] = make_scoped_ptr(new InstanceData); 100 instance_map_[instance] = base::WrapUnique(new InstanceData);
100 } 101 }
101 102
102 void ResourceTracker::DidDeleteInstance(PP_Instance instance) { 103 void ResourceTracker::DidDeleteInstance(PP_Instance instance) {
103 CheckThreadingPreconditions(); 104 CheckThreadingPreconditions();
104 InstanceMap::iterator found_instance = instance_map_.find(instance); 105 InstanceMap::iterator found_instance = instance_map_.find(instance);
105 106
106 // Due to the infrastructure of some tests, the instance is unregistered 107 // Due to the infrastructure of some tests, the instance is unregistered
107 // twice in a few cases. It would be nice not to do that and assert here 108 // twice in a few cases. It would be nice not to do that and assert here
108 // instead. 109 // instead.
109 if (found_instance == instance_map_.end()) 110 if (found_instance == instance_map_.end())
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (res == 0) 254 if (res == 0)
254 return true; 255 return true;
255 256
256 // Skipping the type bits, the least significant bit of |res| should be the 257 // Skipping the type bits, the least significant bit of |res| should be the
257 // same as that of |last_resource_value_|. 258 // same as that of |last_resource_value_|.
258 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1); 259 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1);
259 #endif 260 #endif
260 } 261 }
261 262
262 } // namespace ppapi 263 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/resource_tracker.h ('k') | ppapi/shared_impl/thread_aware_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698