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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
10 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/process_util.h" |
11 #include "ipc/ipc_sync_channel.h" | 14 #include "ipc/ipc_sync_channel.h" |
12 #include "ppapi/c/pp_errors.h" | 15 #include "ppapi/c/pp_errors.h" |
13 #include "ppapi/c/private/ppb_proxy_private.h" | 16 #include "ppapi/c/private/ppb_proxy_private.h" |
14 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
15 | 18 |
16 namespace ppapi { | 19 namespace ppapi { |
17 namespace proxy { | 20 namespace proxy { |
18 | 21 |
19 namespace { | 22 namespace { |
20 // HostDispatcher requires a PPB_Proxy_Private, so we always provide a fallback | 23 // HostDispatcher requires a PPB_Proxy_Private, so we always provide a fallback |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 TwoWayTest::~TwoWayTest() { | 411 TwoWayTest::~TwoWayTest() { |
409 shutdown_event_.Signal(); | 412 shutdown_event_.Signal(); |
410 } | 413 } |
411 | 414 |
412 void TwoWayTest::SetUp() { | 415 void TwoWayTest::SetUp() { |
413 base::Thread::Options options; | 416 base::Thread::Options options; |
414 options.message_loop_type = MessageLoop::TYPE_IO; | 417 options.message_loop_type = MessageLoop::TYPE_IO; |
415 io_thread_.StartWithOptions(options); | 418 io_thread_.StartWithOptions(options); |
416 plugin_thread_.Start(); | 419 plugin_thread_.Start(); |
417 | 420 |
418 IPC::ChannelHandle handle; | 421 // Construct the IPC handle name using the process ID so we can safely run |
419 handle.name = "TwoWayTestChannel"; | 422 // multiple |TwoWayTest|s concurrently. |
| 423 std::ostringstream handle_name; |
| 424 handle_name << "TwoWayTestChannel" << base::GetCurrentProcId(); |
| 425 IPC::ChannelHandle handle(handle_name.str()); |
420 base::WaitableEvent remote_harness_set_up(true, false); | 426 base::WaitableEvent remote_harness_set_up(true, false); |
421 plugin_thread_.message_loop_proxy()->PostTask( | 427 plugin_thread_.message_loop_proxy()->PostTask( |
422 FROM_HERE, | 428 FROM_HERE, |
423 base::Bind(&SetUpRemoteHarness, | 429 base::Bind(&SetUpRemoteHarness, |
424 remote_harness_, | 430 remote_harness_, |
425 handle, | 431 handle, |
426 io_thread_.message_loop_proxy(), | 432 io_thread_.message_loop_proxy(), |
427 &shutdown_event_, | 433 &shutdown_event_, |
428 &remote_harness_set_up)); | 434 &remote_harness_set_up)); |
429 remote_harness_set_up.Wait(); | 435 remote_harness_set_up.Wait(); |
(...skipping 22 matching lines...) Expand all Loading... |
452 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, | 458 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, |
453 base::Bind(&RunTaskOnRemoteHarness, | 459 base::Bind(&RunTaskOnRemoteHarness, |
454 task, | 460 task, |
455 &task_complete)); | 461 &task_complete)); |
456 task_complete.Wait(); | 462 task_complete.Wait(); |
457 } | 463 } |
458 | 464 |
459 | 465 |
460 } // namespace proxy | 466 } // namespace proxy |
461 } // namespace ppapi | 467 } // namespace ppapi |
OLD | NEW |