| 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/c/dev/ppb_var_deprecated.h" | 5 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 6 #include "ppapi/c/dev/ppp_class_deprecated.h" | 6 #include "ppapi/c/dev/ppp_class_deprecated.h" |
| 7 #include "ppapi/c/pp_var.h" | 7 #include "ppapi/c/pp_var.h" |
| 8 #include "ppapi/c/ppb_var.h" | 8 #include "ppapi/c/ppb_var.h" |
| 9 #include "ppapi/c/ppp_instance.h" | 9 #include "ppapi/c/ppp_instance.h" |
| 10 #include "ppapi/c/private/ppp_instance_private.h" | 10 #include "ppapi/c/private/ppp_instance_private.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( | 149 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( |
| 150 host().host_dispatcher()->GetProxiedInterface( | 150 host().host_dispatcher()->GetProxiedInterface( |
| 151 PPP_INSTANCE_INTERFACE_1_0)); | 151 PPP_INSTANCE_INTERFACE_1_0)); |
| 152 | 152 |
| 153 // Initialize an Instance, so that the plugin-side machinery will work | 153 // Initialize an Instance, so that the plugin-side machinery will work |
| 154 // properly. | 154 // properly. |
| 155 EXPECT_EQ(PP_TRUE, ppp_instance->DidCreate(kInstance, 0, NULL, NULL)); | 155 EXPECT_EQ(PP_TRUE, ppp_instance->DidCreate(kInstance, 0, NULL, NULL)); |
| 156 | 156 |
| 157 // Now instance_obj is valid and should have a ref-count of 1. | 157 // Now instance_obj is valid and should have a ref-count of 1. |
| 158 PluginVarTracker& plugin_var_tracker = | 158 PluginVarTracker& plugin_var_tracker = |
| 159 *PluginGlobals::Get()->plugin_var_tracker(); | 159 PluginResourceTracker::GetInstance()->var_tracker(); |
| 160 // Check the plugin-side reference count. | 160 // Check the plugin-side reference count. |
| 161 EXPECT_EQ(1, plugin_var_tracker.GetRefCountForObject(instance_obj)); | 161 EXPECT_EQ(1, plugin_var_tracker.GetRefCountForObject(instance_obj)); |
| 162 // Check the host-side var and reference count. | 162 // Check the host-side var and reference count. |
| 163 ASSERT_EQ(1u, id_refcount_map.size()); | 163 ASSERT_EQ(1u, id_refcount_map.size()); |
| 164 EXPECT_EQ(plugin_var_tracker.GetHostObject(instance_obj).value.as_id, | 164 EXPECT_EQ(plugin_var_tracker.GetHostObject(instance_obj).value.as_id, |
| 165 id_refcount_map.begin()->first); | 165 id_refcount_map.begin()->first); |
| 166 EXPECT_EQ(0, id_refcount_map.begin()->second); | 166 EXPECT_EQ(0, id_refcount_map.begin()->second); |
| 167 | 167 |
| 168 // Call from the browser side to get the instance object. | 168 // Call from the browser side to get the instance object. |
| 169 PP_Var host_obj = ppp_instance_private->GetInstanceObject(kInstance); | 169 PP_Var host_obj = ppp_instance_private->GetInstanceObject(kInstance); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 182 // instance_obj, so it should also be destroyed. | 182 // instance_obj, so it should also be destroyed. |
| 183 ppp_instance->DidDestroy(kInstance); | 183 ppp_instance->DidDestroy(kInstance); |
| 184 EXPECT_EQ(-1, plugin_var_tracker.GetRefCountForObject(instance_obj)); | 184 EXPECT_EQ(-1, plugin_var_tracker.GetRefCountForObject(instance_obj)); |
| 185 // Check the host-side reference count. | 185 // Check the host-side reference count. |
| 186 EXPECT_EQ(0u, id_refcount_map.size()); | 186 EXPECT_EQ(0u, id_refcount_map.size()); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace proxy | 189 } // namespace proxy |
| 190 } // namespace ppapi | 190 } // namespace ppapi |
| 191 | 191 |
| OLD | NEW |