Chromium Code Reviews| 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 #include "ppapi/shared_impl/var_tracker.h" | 5 #include "ppapi/shared_impl/var_tracker.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ppapi/shared_impl/id_assignment.h" | 10 #include "ppapi/shared_impl/id_assignment.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 info.ref_count--; | 93 info.ref_count--; |
| 94 | 94 |
| 95 if (info.ref_count == 0) { | 95 if (info.ref_count == 0) { |
| 96 if (info.var->GetType() == PP_VARTYPE_OBJECT) { | 96 if (info.var->GetType() == PP_VARTYPE_OBJECT) { |
| 97 // Objects have special requirements and may not necessarily be released | 97 // Objects have special requirements and may not necessarily be released |
| 98 // when the refcount goes to 0. | 98 // when the refcount goes to 0. |
| 99 ObjectGettingZeroRef(found); | 99 ObjectGettingZeroRef(found); |
| 100 } else { | 100 } else { |
| 101 // All other var types can just be released. | 101 // All other var types can just be released. |
| 102 DCHECK(info.track_with_no_reference_count == 0); | 102 DCHECK(info.track_with_no_reference_count == 0); |
| 103 info.var->AssignVarID(0); | |
|
dmichael (off chromium)
2011/12/16 03:04:29
This landed with the other patch, right? So I'll j
Takashi Toyoshima
2011/12/16 05:36:38
This change was landed as another CL, and was remo
| |
| 103 live_vars_.erase(found); | 104 live_vars_.erase(found); |
| 104 } | 105 } |
| 105 } | 106 } |
| 106 return true; | 107 return true; |
| 107 } | 108 } |
| 108 | 109 |
| 109 bool VarTracker::ReleaseVar(const PP_Var& var) { | 110 bool VarTracker::ReleaseVar(const PP_Var& var) { |
| 110 if (!IsVarTypeRefcounted(var.type)) | 111 if (!IsVarTypeRefcounted(var.type)) |
| 111 return false; | 112 return false; |
| 112 return ReleaseVar(static_cast<int32>(var.value.as_id)); | 113 return ReleaseVar(static_cast<int32>(var.value.as_id)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 | 153 |
| 153 bool VarTracker::DeleteObjectInfoIfNecessary(VarMap::iterator iter) { | 154 bool VarTracker::DeleteObjectInfoIfNecessary(VarMap::iterator iter) { |
| 154 if (iter->second.ref_count != 0 || | 155 if (iter->second.ref_count != 0 || |
| 155 iter->second.track_with_no_reference_count != 0) | 156 iter->second.track_with_no_reference_count != 0) |
| 156 return false; // Object still alive. | 157 return false; // Object still alive. |
| 157 live_vars_.erase(iter); | 158 live_vars_.erase(iter); |
| 158 return true; | 159 return true; |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace ppapi | 162 } // namespace ppapi |
| OLD | NEW |