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

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

Issue 19492014: PPAPI: Purposely leak ProxyLock, fix shutdown race (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove static initializer Created 7 years, 3 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/plugin_globals.cc ('k') | ppapi/proxy/raw_var_data_unittest.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 "ppapi/proxy/ppapi_proxy_test.h" 5 #include "ppapi/proxy/ppapi_proxy_test.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 resource_tracker().DidDeleteInstance(pp_instance()); 221 resource_tracker().DidDeleteInstance(pp_instance());
222 } 222 }
223 plugin_globals_.reset(); 223 plugin_globals_.reset();
224 } 224 }
225 225
226 void PluginProxyTestHarness::CreatePluginGlobals() { 226 void PluginProxyTestHarness::CreatePluginGlobals() {
227 if (globals_config_ == PER_THREAD_GLOBALS) { 227 if (globals_config_ == PER_THREAD_GLOBALS) {
228 plugin_globals_.reset(new PluginGlobals(PpapiGlobals::PerThreadForTest())); 228 plugin_globals_.reset(new PluginGlobals(PpapiGlobals::PerThreadForTest()));
229 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); 229 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
230 // Enable locking in case some other unit test ran before us and disabled
231 // locking.
232 ProxyLock::EnableLockingOnThreadForTest();
230 } else { 233 } else {
231 plugin_globals_.reset(new PluginGlobals()); 234 plugin_globals_.reset(new PluginGlobals());
235 ProxyLock::EnableLockingOnThreadForTest();
232 } 236 }
233 } 237 }
234 238
235 base::MessageLoopProxy* 239 base::MessageLoopProxy*
236 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() { 240 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() {
237 return ipc_message_loop_; 241 return ipc_message_loop_;
238 } 242 }
239 243
240 base::WaitableEvent* 244 base::WaitableEvent*
241 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() { 245 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 void HostProxyTestHarness::TearDownHarness() { 468 void HostProxyTestHarness::TearDownHarness() {
465 HostDispatcher::RemoveForInstance(pp_instance()); 469 HostDispatcher::RemoveForInstance(pp_instance());
466 host_dispatcher_.reset(); 470 host_dispatcher_.reset();
467 host_globals_.reset(); 471 host_globals_.reset();
468 } 472 }
469 473
470 void HostProxyTestHarness::CreateHostGlobals() { 474 void HostProxyTestHarness::CreateHostGlobals() {
471 if (globals_config_ == PER_THREAD_GLOBALS) { 475 if (globals_config_ == PER_THREAD_GLOBALS) {
472 host_globals_.reset(new TestGlobals(PpapiGlobals::PerThreadForTest())); 476 host_globals_.reset(new TestGlobals(PpapiGlobals::PerThreadForTest()));
473 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); 477 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
478 // The host side of the proxy does not lock.
479 ProxyLock::DisableLockingOnThreadForTest();
474 } else { 480 } else {
481 ProxyLock::DisableLockingOnThreadForTest();
475 host_globals_.reset(new TestGlobals()); 482 host_globals_.reset(new TestGlobals());
476 } 483 }
477 } 484 }
478 485
479 base::MessageLoopProxy* 486 base::MessageLoopProxy*
480 HostProxyTestHarness::DelegateMock::GetIPCMessageLoop() { 487 HostProxyTestHarness::DelegateMock::GetIPCMessageLoop() {
481 return ipc_message_loop_; 488 return ipc_message_loop_;
482 } 489 }
483 490
484 base::WaitableEvent* HostProxyTestHarness::DelegateMock::GetShutdownEvent() { 491 base::WaitableEvent* HostProxyTestHarness::DelegateMock::GetShutdownEvent() {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, 590 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE,
584 base::Bind(&RunTaskOnRemoteHarness, 591 base::Bind(&RunTaskOnRemoteHarness,
585 task, 592 task,
586 &task_complete)); 593 &task_complete));
587 task_complete.Wait(); 594 task_complete.Wait();
588 } 595 }
589 596
590 597
591 } // namespace proxy 598 } // namespace proxy
592 } // namespace ppapi 599 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_globals.cc ('k') | ppapi/proxy/raw_var_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698