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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 DCHECK(peer_pid != base::kNullProcessId); | 199 DCHECK(peer_pid != base::kNullProcessId); |
200 return BrokerGetFileHandleForProcess(handle, peer_pid, should_close_source); | 200 return BrokerGetFileHandleForProcess(handle, peer_pid, should_close_source); |
201 } | 201 } |
202 | 202 |
203 base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote( | 203 base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote( |
204 const base::SharedMemoryHandle& handle, | 204 const base::SharedMemoryHandle& handle, |
205 base::ProcessId remote_pid) { | 205 base::ProcessId remote_pid) { |
206 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
207 if (peer_handle_.IsValid()) { | 207 if (peer_handle_.IsValid()) { |
208 DCHECK(is_broker_); | 208 DCHECK(is_broker_); |
209 return IPC::GetFileHandleForProcess(handle, peer_handle_.Get(), false); | 209 IPC::PlatformFileForTransit platform_file = IPC::GetFileHandleForProcess( |
| 210 handle.GetHandle(), peer_handle_.Get(), false); |
| 211 base::ProcessId pid = base::GetProcId(peer_handle_.Get()); |
| 212 return base::SharedMemoryHandle(platform_file, pid); |
210 } | 213 } |
211 #endif | 214 #endif |
212 | 215 |
213 DCHECK(remote_pid != base::kNullProcessId); | 216 DCHECK(remote_pid != base::kNullProcessId); |
214 #if defined(OS_WIN) || defined(OS_MACOSX) | 217 #if defined(OS_WIN) || defined(OS_MACOSX) |
215 base::SharedMemoryHandle duped_handle; | 218 base::SharedMemoryHandle duped_handle; |
216 bool success = | 219 bool success = |
217 BrokerDuplicateSharedMemoryHandle(handle, remote_pid, &duped_handle); | 220 BrokerDuplicateSharedMemoryHandle(handle, remote_pid, &duped_handle); |
218 if (success) | 221 if (success) |
219 return duped_handle; | 222 return duped_handle; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 GetHistogramName(is_broker_, "LoadTime", path), | 605 GetHistogramName(is_broker_, "LoadTime", path), |
603 base::TimeDelta::FromMilliseconds(1), | 606 base::TimeDelta::FromMilliseconds(1), |
604 base::TimeDelta::FromSeconds(10), | 607 base::TimeDelta::FromSeconds(10), |
605 50, | 608 50, |
606 base::HistogramBase::kUmaTargetedHistogramFlag); | 609 base::HistogramBase::kUmaTargetedHistogramFlag); |
607 | 610 |
608 histogram->AddTime(load_time); | 611 histogram->AddTime(load_time); |
609 } | 612 } |
610 | 613 |
611 } // namespace content | 614 } // namespace content |
OLD | NEW |