| 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/proxy/ppapi_proxy_test.h" | 5 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/proxy_object_var.h" | 7 #include "ppapi/proxy/proxy_object_var.h" |
| 8 #include "ppapi/proxy/serialized_var.h" | 8 #include "ppapi/proxy/serialized_var.h" |
| 9 #include "ppapi/shared_impl/proxy_lock.h" | 9 #include "ppapi/shared_impl/proxy_lock.h" |
| 10 | 10 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // ReceiveInputs keep the "track_with_no_reference_count" alive until | 251 // ReceiveInputs keep the "track_with_no_reference_count" alive until |
| 252 // they're destroyed. | 252 // they're destroyed. |
| 253 var_tracker().AddRefVar(plugin_objects[0]); | 253 var_tracker().AddRefVar(plugin_objects[0]); |
| 254 EXPECT_EQ(1, var_tracker().GetRefCountForObject(plugin_objects[0])); | 254 EXPECT_EQ(1, var_tracker().GetRefCountForObject(plugin_objects[0])); |
| 255 var_tracker().ReleaseVar(plugin_objects[0]); | 255 var_tracker().ReleaseVar(plugin_objects[0]); |
| 256 EXPECT_EQ(0, var_tracker().GetRefCountForObject(plugin_objects[0])); | 256 EXPECT_EQ(0, var_tracker().GetRefCountForObject(plugin_objects[0])); |
| 257 EXPECT_EQ(2u, sink().message_count()); | 257 EXPECT_EQ(2u, sink().message_count()); |
| 258 | 258 |
| 259 // Take a reference to a string and then release it. Make sure no messages | 259 // Take a reference to a string and then release it. Make sure no messages |
| 260 // are sent. | 260 // are sent. |
| 261 uint32_t old_message_count = sink().message_count(); | 261 uint32_t old_message_count = static_cast<uint32_t>(sink().message_count()); |
| 262 var_tracker().AddRefVar(plugin_objects[1]); | 262 var_tracker().AddRefVar(plugin_objects[1]); |
| 263 EXPECT_EQ(2, var_tracker().GetRefCountForObject(plugin_objects[1])); | 263 EXPECT_EQ(2, var_tracker().GetRefCountForObject(plugin_objects[1])); |
| 264 var_tracker().ReleaseVar(plugin_objects[1]); | 264 var_tracker().ReleaseVar(plugin_objects[1]); |
| 265 EXPECT_EQ(1, var_tracker().GetRefCountForObject(plugin_objects[1])); | 265 EXPECT_EQ(1, var_tracker().GetRefCountForObject(plugin_objects[1])); |
| 266 EXPECT_EQ(old_message_count, sink().message_count()); | 266 EXPECT_EQ(old_message_count, sink().message_count()); |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Since we didn't keep any refs to the objects or strings, so they should | 269 // Since we didn't keep any refs to the objects or strings, so they should |
| 270 // have been freed. | 270 // have been freed. |
| 271 EXPECT_EQ(-1, var_tracker().GetRefCountForObject(plugin_objects[0])); | 271 EXPECT_EQ(-1, var_tracker().GetRefCountForObject(plugin_objects[0])); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 } | 378 } |
| 379 | 379 |
| 380 // When the ReturnValue object goes out of scope, it should have sent a | 380 // When the ReturnValue object goes out of scope, it should have sent a |
| 381 // release message to the browser. | 381 // release message to the browser. |
| 382 EXPECT_EQ(-1, var_tracker().GetRefCountForObject(plugin_object)); | 382 EXPECT_EQ(-1, var_tracker().GetRefCountForObject(plugin_object)); |
| 383 EXPECT_EQ(1u, sink().message_count()); | 383 EXPECT_EQ(1u, sink().message_count()); |
| 384 } | 384 } |
| 385 | 385 |
| 386 } // namespace proxy | 386 } // namespace proxy |
| 387 } // namespace ppapi | 387 } // namespace ppapi |
| OLD | NEW |