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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 | 10 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 router_.RemoveRoute(route_id); | 308 router_.RemoveRoute(route_id); |
309 } | 309 } |
310 | 310 |
311 bool GpuChannel::ShouldPreferDiscreteGpu() const { | 311 bool GpuChannel::ShouldPreferDiscreteGpu() const { |
312 return num_contexts_preferring_discrete_gpu_ > 0; | 312 return num_contexts_preferring_discrete_gpu_ > 0; |
313 } | 313 } |
314 | 314 |
315 void GpuChannel::OnInitialize(base::ProcessHandle renderer_process) { | 315 void GpuChannel::OnInitialize(base::ProcessHandle renderer_process) { |
316 // Initialize should only happen once. | 316 // Initialize should only happen once. |
317 DCHECK(!renderer_process_); | 317 DCHECK(!renderer_process_); |
318 renderer_process_ = renderer_process; | 318 |
| 319 // Verify that the renderer has passed its own process handle. |
| 320 if (base::GetProcId(renderer_process) == renderer_pid_) |
| 321 renderer_process_ = renderer_process; |
319 } | 322 } |
320 | 323 |
321 void GpuChannel::OnCreateOffscreenCommandBuffer( | 324 void GpuChannel::OnCreateOffscreenCommandBuffer( |
322 const gfx::Size& size, | 325 const gfx::Size& size, |
323 const GPUCreateCommandBufferConfig& init_params, | 326 const GPUCreateCommandBufferConfig& init_params, |
324 IPC::Message* reply_message) { | 327 IPC::Message* reply_message) { |
325 int32 route_id = MSG_ROUTING_NONE; | 328 int32 route_id = MSG_ROUTING_NONE; |
326 | 329 |
327 content::GetContentClient()->SetActiveURL(init_params.active_url); | 330 content::GetContentClient()->SetActiveURL(init_params.active_url); |
328 #if defined(ENABLE_GPU) | 331 #if defined(ENABLE_GPU) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 444 |
442 #if defined(OS_POSIX) | 445 #if defined(OS_POSIX) |
443 int GpuChannel::TakeRendererFileDescriptor() { | 446 int GpuChannel::TakeRendererFileDescriptor() { |
444 if (!channel_.get()) { | 447 if (!channel_.get()) { |
445 NOTREACHED(); | 448 NOTREACHED(); |
446 return -1; | 449 return -1; |
447 } | 450 } |
448 return channel_->TakeClientFileDescriptor(); | 451 return channel_->TakeClientFileDescriptor(); |
449 } | 452 } |
450 #endif // defined(OS_POSIX) | 453 #endif // defined(OS_POSIX) |
OLD | NEW |