Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Side by Side Diff: ppapi/proxy/ppp_instance_private_proxy_unittest.cc

Issue 9348092: Revert 121901 - PPAPI: Add unlocking for PPP calls and callbacks. Add more locking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppp_instance_private_proxy.cc ('k') | ppapi/proxy/ppp_messaging_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/test/test_timeouts.h" 7 #include "base/test/test_timeouts.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "ppapi/c/dev/ppb_var_deprecated.h" 9 #include "ppapi/c/dev/ppb_var_deprecated.h"
10 #include "ppapi/c/dev/ppp_class_deprecated.h" 10 #include "ppapi/c/dev/ppp_class_deprecated.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 plugin_dispatcher->GetBrowserInterface( 51 plugin_dispatcher->GetBrowserInterface(
52 PPB_VAR_DEPRECATED_INTERFACE)); 52 PPB_VAR_DEPRECATED_INTERFACE));
53 } 53 }
54 54
55 // Mock PPP_Instance_Private. 55 // Mock PPP_Instance_Private.
56 PP_Var instance_obj; 56 PP_Var instance_obj;
57 PP_Var GetInstanceObject(PP_Instance /*instance*/) { 57 PP_Var GetInstanceObject(PP_Instance /*instance*/) {
58 // The 1 ref we got from CreateObject will be passed to the host. We want to 58 // The 1 ref we got from CreateObject will be passed to the host. We want to
59 // have a ref of our own. 59 // have a ref of our own.
60 printf("GetInstanceObject called\n"); 60 printf("GetInstanceObject called\n");
61 plugin_var_deprecated_if()->AddRef(instance_obj); 61 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(instance_obj);
62 return instance_obj; 62 return instance_obj;
63 } 63 }
64 64
65 PPP_Instance_Private ppp_instance_private_mock = { 65 PPP_Instance_Private ppp_instance_private_mock = {
66 &GetInstanceObject 66 &GetInstanceObject
67 }; 67 };
68 68
69 // We need to mock PPP_Instance, so that we can create and destroy the pretend 69 // We need to mock PPP_Instance, so that we can create and destroy the pretend
70 // instance that PPP_Instance_Private uses. 70 // instance that PPP_Instance_Private uses.
71 PP_Bool DidCreate(PP_Instance /*instance*/, uint32_t /*argc*/, 71 PP_Bool DidCreate(PP_Instance /*instance*/, uint32_t /*argc*/,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Destroy the instance. DidDestroy above decrements the reference count for 175 // Destroy the instance. DidDestroy above decrements the reference count for
176 // instance_obj, so it should also be destroyed. 176 // instance_obj, so it should also be destroyed.
177 ppp_instance->DidDestroy(kInstance); 177 ppp_instance->DidDestroy(kInstance);
178 EXPECT_EQ(-1, plugin().var_tracker().GetRefCountForObject(instance_obj)); 178 EXPECT_EQ(-1, plugin().var_tracker().GetRefCountForObject(instance_obj));
179 EXPECT_EQ(-1, host().var_tracker().GetRefCountForObject(host_pp_var)); 179 EXPECT_EQ(-1, host().var_tracker().GetRefCountForObject(host_pp_var));
180 } 180 }
181 181
182 } // namespace proxy 182 } // namespace proxy
183 } // namespace ppapi 183 } // namespace ppapi
184 184
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_instance_private_proxy.cc ('k') | ppapi/proxy/ppp_messaging_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698