| OLD | NEW |
| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "ppapi/shared_impl/callback_tracker.h" | 10 #include "ppapi/shared_impl/callback_tracker.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 void ResourceTracker::DidCreateInstance(PP_Instance instance) { | 92 void ResourceTracker::DidCreateInstance(PP_Instance instance) { |
| 93 CheckThreadingPreconditions(); | 93 CheckThreadingPreconditions(); |
| 94 // Due to the infrastructure of some tests, the instance is registered | 94 // 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 | 95 // twice in a few cases. It would be nice not to do that and assert here |
| 96 // instead. | 96 // instead. |
| 97 if (instance_map_.find(instance) != instance_map_.end()) | 97 if (instance_map_.find(instance) != instance_map_.end()) |
| 98 return; | 98 return; |
| 99 instance_map_[instance] = linked_ptr<InstanceData>(new InstanceData); | 99 instance_map_[instance] = make_scoped_ptr(new InstanceData); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void ResourceTracker::DidDeleteInstance(PP_Instance instance) { | 102 void ResourceTracker::DidDeleteInstance(PP_Instance instance) { |
| 103 CheckThreadingPreconditions(); | 103 CheckThreadingPreconditions(); |
| 104 InstanceMap::iterator found_instance = instance_map_.find(instance); | 104 InstanceMap::iterator found_instance = instance_map_.find(instance); |
| 105 | 105 |
| 106 // Due to the infrastructure of some tests, the instance is unregistered | 106 // 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 | 107 // twice in a few cases. It would be nice not to do that and assert here |
| 108 // instead. | 108 // instead. |
| 109 if (found_instance == instance_map_.end()) | 109 if (found_instance == instance_map_.end()) |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 if (res == 0) | 253 if (res == 0) |
| 254 return true; | 254 return true; |
| 255 | 255 |
| 256 // Skipping the type bits, the least significant bit of |res| should be the | 256 // Skipping the type bits, the least significant bit of |res| should be the |
| 257 // same as that of |last_resource_value_|. | 257 // same as that of |last_resource_value_|. |
| 258 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1); | 258 return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1); |
| 259 #endif | 259 #endif |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace ppapi | 262 } // namespace ppapi |
| OLD | NEW |