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/common/child_process_host_impl.h" | 5 #include "content/common/child_process_host_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 263 } |
264 | 264 |
265 #ifdef IPC_MESSAGE_LOG_ENABLED | 265 #ifdef IPC_MESSAGE_LOG_ENABLED |
266 if (logger->Enabled()) | 266 if (logger->Enabled()) |
267 logger->OnPostDispatchMessage(msg, channel_id_); | 267 logger->OnPostDispatchMessage(msg, channel_id_); |
268 #endif | 268 #endif |
269 return handled; | 269 return handled; |
270 } | 270 } |
271 | 271 |
272 void ChildProcessHostImpl::OnChannelConnected(int32 peer_pid) { | 272 void ChildProcessHostImpl::OnChannelConnected(int32 peer_pid) { |
273 if (!base::OpenPrivilegedProcessHandle(peer_pid, &peer_handle_)) { | 273 if (!peer_handle_ && |
| 274 !base::OpenPrivilegedProcessHandle(peer_pid, &peer_handle_) && |
| 275 !(peer_handle_ = delegate_->GetHandle())) { |
274 NOTREACHED(); | 276 NOTREACHED(); |
275 } | 277 } |
276 opening_channel_ = false; | 278 opening_channel_ = false; |
277 delegate_->OnChannelConnected(peer_pid); | 279 delegate_->OnChannelConnected(peer_pid); |
278 for (size_t i = 0; i < filters_.size(); ++i) | 280 for (size_t i = 0; i < filters_.size(); ++i) |
279 filters_[i]->OnChannelConnected(peer_pid); | 281 filters_[i]->OnChannelConnected(peer_pid); |
280 } | 282 } |
281 | 283 |
282 void ChildProcessHostImpl::OnChannelError() { | 284 void ChildProcessHostImpl::OnChannelError() { |
283 opening_channel_ = false; | 285 opening_channel_ = false; |
(...skipping 23 matching lines...) Expand all Loading... |
307 uint32 internalformat, | 309 uint32 internalformat, |
308 gfx::GpuMemoryBufferHandle* handle) { | 310 gfx::GpuMemoryBufferHandle* handle) { |
309 handle->type = gfx::SHARED_MEMORY_BUFFER; | 311 handle->type = gfx::SHARED_MEMORY_BUFFER; |
310 AllocateSharedMemory( | 312 AllocateSharedMemory( |
311 width * height * GpuMemoryBufferImpl::BytesPerPixel(internalformat), | 313 width * height * GpuMemoryBufferImpl::BytesPerPixel(internalformat), |
312 peer_handle_, | 314 peer_handle_, |
313 &handle->handle); | 315 &handle->handle); |
314 } | 316 } |
315 | 317 |
316 } // namespace content | 318 } // namespace content |
OLD | NEW |