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 "webkit/plugins/ppapi/ppapi_unittest.h" | 5 #include "webkit/plugins/ppapi/ppapi_unittest.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
9 #include "ppapi/c/ppp_instance.h" | 9 #include "ppapi/c/ppp_instance.h" |
10 #include "third_party/npapi/bindings/npruntime.h" | 10 #include "third_party/npapi/bindings/npruntime.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // This ObjectVar must be released before we do NPObjectToPPVar again | 209 // This ObjectVar must be released before we do NPObjectToPPVar again |
210 // below so it gets freed and we get a new identifier. | 210 // below so it gets freed and we get a new identifier. |
211 { | 211 { |
212 scoped_refptr<NPObjectVar> check_object(NPObjectVar::FromPPVar(pp_object1)); | 212 scoped_refptr<NPObjectVar> check_object(NPObjectVar::FromPPVar(pp_object1)); |
213 ASSERT_TRUE(check_object.get()); | 213 ASSERT_TRUE(check_object.get()); |
214 EXPECT_EQ(instance()->pp_instance(), check_object->pp_instance()); | 214 EXPECT_EQ(instance()->pp_instance(), check_object->pp_instance()); |
215 EXPECT_EQ(npobject.get(), check_object->np_object()); | 215 EXPECT_EQ(npobject.get(), check_object->np_object()); |
216 } | 216 } |
217 | 217 |
218 // Remove both of the refs we made above. | 218 // Remove both of the refs we made above. |
219 tracker().UnrefVar(static_cast<int32_t>(pp_object2.value.as_id)); | 219 ::ppapi::VarTracker* var_tracker = tracker().GetVarTracker(); |
220 tracker().UnrefVar(static_cast<int32_t>(pp_object1.value.as_id)); | 220 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object2.value.as_id)); |
| 221 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object1.value.as_id)); |
221 | 222 |
222 // Releasing the resource should free the internal ref, and so making a new | 223 // Releasing the resource should free the internal ref, and so making a new |
223 // one now should generate a new ID. | 224 // one now should generate a new ID. |
224 PP_Var pp_object3 = NPObjectToPPVar(instance(), npobject.get()); | 225 PP_Var pp_object3 = NPObjectToPPVar(instance(), npobject.get()); |
225 EXPECT_NE(pp_object1.value.as_id, pp_object3.value.as_id); | 226 EXPECT_NE(pp_object1.value.as_id, pp_object3.value.as_id); |
226 tracker().UnrefVar(static_cast<int32_t>(pp_object3.value.as_id)); | 227 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object3.value.as_id)); |
227 } | 228 } |
228 | 229 |
229 } // namespace ppapi | 230 } // namespace ppapi |
230 } // namespace webkit | 231 } // namespace webkit |
OLD | NEW |