| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 base::ProcessId /* remote_pid */, | 252 base::ProcessId /* remote_pid */, |
| 253 bool should_close_source) { | 253 bool should_close_source) { |
| 254 return IPC::GetFileHandleForProcess(handle, | 254 return IPC::GetFileHandleForProcess(handle, |
| 255 base::GetCurrentProcessHandle(), | 255 base::GetCurrentProcessHandle(), |
| 256 should_close_source); | 256 should_close_source); |
| 257 } | 257 } |
| 258 | 258 |
| 259 base::SharedMemoryHandle | 259 base::SharedMemoryHandle |
| 260 PluginProxyTestHarness::PluginDelegateMock::ShareSharedMemoryHandleWithRemote( | 260 PluginProxyTestHarness::PluginDelegateMock::ShareSharedMemoryHandleWithRemote( |
| 261 const base::SharedMemoryHandle& handle, | 261 const base::SharedMemoryHandle& handle, |
| 262 base::ProcessId remote_pid) { | 262 base::ProcessId /* remote_pid */) { |
| 263 #if defined(OS_POSIX) | 263 return base::SharedMemory::DuplicateHandle(handle); |
| 264 return ShareHandleWithRemote(handle.fd, remote_pid, false); | |
| 265 #elif defined(OS_WIN) | |
| 266 return ShareHandleWithRemote(handle, remote_pid, false); | |
| 267 #else | |
| 268 #error Not implemented. | |
| 269 #endif | |
| 270 } | 264 } |
| 271 | 265 |
| 272 std::set<PP_Instance>* | 266 std::set<PP_Instance>* |
| 273 PluginProxyTestHarness::PluginDelegateMock::GetGloballySeenInstanceIDSet() { | 267 PluginProxyTestHarness::PluginDelegateMock::GetGloballySeenInstanceIDSet() { |
| 274 return &instance_id_set_; | 268 return &instance_id_set_; |
| 275 } | 269 } |
| 276 | 270 |
| 277 uint32 PluginProxyTestHarness::PluginDelegateMock::Register( | 271 uint32 PluginProxyTestHarness::PluginDelegateMock::Register( |
| 278 PluginDispatcher* plugin_dispatcher) { | 272 PluginDispatcher* plugin_dispatcher) { |
| 279 return 0; | 273 return 0; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 base::ProcessId /* remote_pid */, | 492 base::ProcessId /* remote_pid */, |
| 499 bool should_close_source) { | 493 bool should_close_source) { |
| 500 return IPC::GetFileHandleForProcess(handle, | 494 return IPC::GetFileHandleForProcess(handle, |
| 501 base::GetCurrentProcessHandle(), | 495 base::GetCurrentProcessHandle(), |
| 502 should_close_source); | 496 should_close_source); |
| 503 } | 497 } |
| 504 | 498 |
| 505 base::SharedMemoryHandle | 499 base::SharedMemoryHandle |
| 506 HostProxyTestHarness::DelegateMock::ShareSharedMemoryHandleWithRemote( | 500 HostProxyTestHarness::DelegateMock::ShareSharedMemoryHandleWithRemote( |
| 507 const base::SharedMemoryHandle& handle, | 501 const base::SharedMemoryHandle& handle, |
| 508 base::ProcessId remote_pid) { | 502 base::ProcessId /*remote_pid*/) { |
| 509 #if defined(OS_POSIX) | 503 return base::SharedMemory::DuplicateHandle(handle); |
| 510 return ShareHandleWithRemote(handle.fd, remote_pid, false); | |
| 511 #elif defined(OS_WIN) | |
| 512 return ShareHandleWithRemote(handle, remote_pid, false); | |
| 513 #else | |
| 514 #error Not implemented. | |
| 515 #endif | |
| 516 } | 504 } |
| 517 | 505 |
| 518 // HostProxyTest --------------------------------------------------------------- | 506 // HostProxyTest --------------------------------------------------------------- |
| 519 | 507 |
| 520 HostProxyTest::HostProxyTest() : HostProxyTestHarness(SINGLETON_GLOBALS) { | 508 HostProxyTest::HostProxyTest() : HostProxyTestHarness(SINGLETON_GLOBALS) { |
| 521 } | 509 } |
| 522 | 510 |
| 523 HostProxyTest::~HostProxyTest() { | 511 HostProxyTest::~HostProxyTest() { |
| 524 } | 512 } |
| 525 | 513 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, | 590 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, |
| 603 base::Bind(&RunTaskOnRemoteHarness, | 591 base::Bind(&RunTaskOnRemoteHarness, |
| 604 task, | 592 task, |
| 605 &task_complete)); | 593 &task_complete)); |
| 606 task_complete.Wait(); | 594 task_complete.Wait(); |
| 607 } | 595 } |
| 608 | 596 |
| 609 | 597 |
| 610 } // namespace proxy | 598 } // namespace proxy |
| 611 } // namespace ppapi | 599 } // namespace ppapi |
| OLD | NEW |