| 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 "content/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/cpu.h" | 10 #include "base/cpu.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 DCHECK(peer_pid != base::kNullProcessId); | 201 DCHECK(peer_pid != base::kNullProcessId); |
| 202 return BrokerGetFileHandleForProcess(handle, peer_pid, should_close_source); | 202 return BrokerGetFileHandleForProcess(handle, peer_pid, should_close_source); |
| 203 } | 203 } |
| 204 | 204 |
| 205 base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote( | 205 base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote( |
| 206 const base::SharedMemoryHandle& handle, | 206 const base::SharedMemoryHandle& handle, |
| 207 base::ProcessId remote_pid) { | 207 base::ProcessId remote_pid) { |
| 208 #if defined(OS_WIN) | 208 #if defined(OS_WIN) |
| 209 if (peer_handle_.IsValid()) { | 209 if (peer_handle_.IsValid()) { |
| 210 DCHECK(is_broker_); | 210 DCHECK(is_broker_); |
| 211 return IPC::GetFileHandleForProcess(handle, peer_handle_.Get(), false); | 211 IPC::PlatformFileForTransit platform_file = IPC::GetFileHandleForProcess( |
| 212 handle.GetHandle(), peer_handle_.Get(), false); |
| 213 base::ProcessId pid = base::GetProcId(peer_handle_.Get()); |
| 214 return base::SharedMemoryHandle(platform_file, pid); |
| 212 } | 215 } |
| 213 #endif | 216 #endif |
| 214 | 217 |
| 215 DCHECK(remote_pid != base::kNullProcessId); | 218 DCHECK(remote_pid != base::kNullProcessId); |
| 216 #if defined(OS_WIN) || defined(OS_MACOSX) | 219 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 217 base::SharedMemoryHandle duped_handle; | 220 base::SharedMemoryHandle duped_handle; |
| 218 bool success = | 221 bool success = |
| 219 BrokerDuplicateSharedMemoryHandle(handle, remote_pid, &duped_handle); | 222 BrokerDuplicateSharedMemoryHandle(handle, remote_pid, &duped_handle); |
| 220 if (success) | 223 if (success) |
| 221 return duped_handle; | 224 return duped_handle; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 GetHistogramName(is_broker_, "LoadTime", path), | 619 GetHistogramName(is_broker_, "LoadTime", path), |
| 617 base::TimeDelta::FromMilliseconds(1), | 620 base::TimeDelta::FromMilliseconds(1), |
| 618 base::TimeDelta::FromSeconds(10), | 621 base::TimeDelta::FromSeconds(10), |
| 619 50, | 622 50, |
| 620 base::HistogramBase::kUmaTargetedHistogramFlag); | 623 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 621 | 624 |
| 622 histogram->AddTime(load_time); | 625 histogram->AddTime(load_time); |
| 623 } | 626 } |
| 624 | 627 |
| 625 } // namespace content | 628 } // namespace content |
| OLD | NEW |