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 <sstream> | 7 #include <sstream> |
8 #include <tuple> | 8 #include <tuple> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 plugin_thread_.Start(); | 551 plugin_thread_.Start(); |
552 | 552 |
553 // Construct the IPC handle name using the process ID so we can safely run | 553 // Construct the IPC handle name using the process ID so we can safely run |
554 // multiple |TwoWayTest|s concurrently. | 554 // multiple |TwoWayTest|s concurrently. |
555 std::ostringstream handle_name; | 555 std::ostringstream handle_name; |
556 handle_name << "TwoWayTestChannel" << base::GetCurrentProcId(); | 556 handle_name << "TwoWayTestChannel" << base::GetCurrentProcId(); |
557 IPC::ChannelHandle handle(handle_name.str()); | 557 IPC::ChannelHandle handle(handle_name.str()); |
558 base::WaitableEvent remote_harness_set_up(true, false); | 558 base::WaitableEvent remote_harness_set_up(true, false); |
559 plugin_thread_.task_runner()->PostTask( | 559 plugin_thread_.task_runner()->PostTask( |
560 FROM_HERE, base::Bind(&SetUpRemoteHarness, remote_harness_, handle, | 560 FROM_HERE, base::Bind(&SetUpRemoteHarness, remote_harness_, handle, |
561 io_thread_.task_runner(), &shutdown_event_, | 561 base::RetainedRef(io_thread_.task_runner()), |
562 &remote_harness_set_up)); | 562 &shutdown_event_, &remote_harness_set_up)); |
563 remote_harness_set_up.Wait(); | 563 remote_harness_set_up.Wait(); |
564 local_harness_->SetUpHarnessWithChannel( | 564 local_harness_->SetUpHarnessWithChannel( |
565 handle, io_thread_.task_runner().get(), &shutdown_event_, | 565 handle, io_thread_.task_runner().get(), &shutdown_event_, |
566 true); // is_client | 566 true); // is_client |
567 } | 567 } |
568 | 568 |
569 void TwoWayTest::TearDown() { | 569 void TwoWayTest::TearDown() { |
570 base::WaitableEvent remote_harness_torn_down(true, false); | 570 base::WaitableEvent remote_harness_torn_down(true, false); |
571 plugin_thread_.task_runner()->PostTask( | 571 plugin_thread_.task_runner()->PostTask( |
572 FROM_HERE, base::Bind(&TearDownRemoteHarness, remote_harness_, | 572 FROM_HERE, base::Bind(&TearDownRemoteHarness, remote_harness_, |
573 &remote_harness_torn_down)); | 573 &remote_harness_torn_down)); |
574 remote_harness_torn_down.Wait(); | 574 remote_harness_torn_down.Wait(); |
575 | 575 |
576 local_harness_->TearDownHarness(); | 576 local_harness_->TearDownHarness(); |
577 | 577 |
578 io_thread_.Stop(); | 578 io_thread_.Stop(); |
579 } | 579 } |
580 | 580 |
581 void TwoWayTest::PostTaskOnRemoteHarness(const base::Closure& task) { | 581 void TwoWayTest::PostTaskOnRemoteHarness(const base::Closure& task) { |
582 base::WaitableEvent task_complete(true, false); | 582 base::WaitableEvent task_complete(true, false); |
583 plugin_thread_.task_runner()->PostTask( | 583 plugin_thread_.task_runner()->PostTask( |
584 FROM_HERE, base::Bind(&RunTaskOnRemoteHarness, task, &task_complete)); | 584 FROM_HERE, base::Bind(&RunTaskOnRemoteHarness, task, &task_complete)); |
585 task_complete.Wait(); | 585 task_complete.Wait(); |
586 } | 586 } |
587 | 587 |
588 | 588 |
589 } // namespace proxy | 589 } // namespace proxy |
590 } // namespace ppapi | 590 } // namespace ppapi |
OLD | NEW |