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

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

Issue 9391006: PPAPI: Add unlocking for PPP calls and callbacks. Add more locking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added documentation 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
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 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(instance_obj); 61 plugin_var_deprecated_if()->AddRef(instance_obj);
62 //PpapiGlobals::Get()->GetVarTracker()->AddRefVar(instance_obj);
brettw 2012/02/13 20:52:34 Delete this line?
dmichael (off chromium) 2012/02/13 21:15:33 Done.
62 return instance_obj; 63 return instance_obj;
63 } 64 }
64 65
65 PPP_Instance_Private ppp_instance_private_mock = { 66 PPP_Instance_Private ppp_instance_private_mock = {
66 &GetInstanceObject 67 &GetInstanceObject
67 }; 68 };
68 69
69 // We need to mock PPP_Instance, so that we can create and destroy the pretend 70 // We need to mock PPP_Instance, so that we can create and destroy the pretend
70 // instance that PPP_Instance_Private uses. 71 // instance that PPP_Instance_Private uses.
71 PP_Bool DidCreate(PP_Instance /*instance*/, uint32_t /*argc*/, 72 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 176 // Destroy the instance. DidDestroy above decrements the reference count for
176 // instance_obj, so it should also be destroyed. 177 // instance_obj, so it should also be destroyed.
177 ppp_instance->DidDestroy(kInstance); 178 ppp_instance->DidDestroy(kInstance);
178 EXPECT_EQ(-1, plugin().var_tracker().GetRefCountForObject(instance_obj)); 179 EXPECT_EQ(-1, plugin().var_tracker().GetRefCountForObject(instance_obj));
179 EXPECT_EQ(-1, host().var_tracker().GetRefCountForObject(host_pp_var)); 180 EXPECT_EQ(-1, host().var_tracker().GetRefCountForObject(host_pp_var));
180 } 181 }
181 182
182 } // namespace proxy 183 } // namespace proxy
183 } // namespace ppapi 184 } // namespace ppapi
184 185
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698