| 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/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) | 684 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) |
| 685 IPC_END_MESSAGE_MAP() | 685 IPC_END_MESSAGE_MAP() |
| 686 | 686 |
| 687 return true; | 687 return true; |
| 688 } | 688 } |
| 689 | 689 |
| 690 #if defined(OS_WIN) | 690 #if defined(OS_WIN) |
| 691 void GpuProcessHost::OnAcceleratedSurfaceCreatedChildWindow( | 691 void GpuProcessHost::OnAcceleratedSurfaceCreatedChildWindow( |
| 692 gpu::SurfaceHandle parent_handle, | 692 gpu::SurfaceHandle parent_handle, |
| 693 gpu::SurfaceHandle window_handle) { | 693 gpu::SurfaceHandle window_handle) { |
| 694 constexpr char kBadMessageError[] = "Bad parenting request from gpu process."; |
| 694 if (!in_process_) { | 695 if (!in_process_) { |
| 695 DCHECK(process_); | 696 DCHECK(process_); |
| 696 { | 697 { |
| 697 DWORD process_id = 0; | 698 DWORD process_id = 0; |
| 698 DWORD thread_id = GetWindowThreadProcessId(parent_handle, &process_id); | 699 DWORD thread_id = GetWindowThreadProcessId(parent_handle, &process_id); |
| 699 | 700 |
| 700 if (!thread_id || process_id != ::GetCurrentProcessId()) { | 701 if (!thread_id || process_id != ::GetCurrentProcessId()) { |
| 701 process_->TerminateOnBadMessageReceived( | 702 process_->TerminateOnBadMessageReceived(kBadMessageError); |
| 702 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); | |
| 703 return; | 703 return; |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 | 706 |
| 707 { | 707 { |
| 708 DWORD process_id = 0; | 708 DWORD process_id = 0; |
| 709 DWORD thread_id = GetWindowThreadProcessId(window_handle, &process_id); | 709 DWORD thread_id = GetWindowThreadProcessId(window_handle, &process_id); |
| 710 | 710 |
| 711 if (!thread_id || process_id != process_->GetProcess().Pid()) { | 711 if (!thread_id || process_id != process_->GetProcess().Pid()) { |
| 712 process_->TerminateOnBadMessageReceived( | 712 process_->TerminateOnBadMessageReceived(kBadMessageError); |
| 713 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); | |
| 714 return; | 713 return; |
| 715 } | 714 } |
| 716 } | 715 } |
| 717 } | 716 } |
| 718 | 717 |
| 719 if (!gfx::RenderingWindowManager::GetInstance()->RegisterChild( | 718 if (!gfx::RenderingWindowManager::GetInstance()->RegisterChild( |
| 720 parent_handle, window_handle)) { | 719 parent_handle, window_handle)) { |
| 721 process_->TerminateOnBadMessageReceived( | 720 process_->TerminateOnBadMessageReceived(kBadMessageError); |
| 722 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); | |
| 723 } | 721 } |
| 724 } | 722 } |
| 725 #endif | 723 #endif |
| 726 | 724 |
| 727 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) { | 725 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) { |
| 728 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelConnected"); | 726 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelConnected"); |
| 729 | 727 |
| 730 while (!queued_messages_.empty()) { | 728 while (!queued_messages_.empty()) { |
| 731 Send(queued_messages_.front()); | 729 Send(queued_messages_.front()); |
| 732 queued_messages_.pop(); | 730 queued_messages_.pop(); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1195 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1198 ClientIdToShaderCacheMap::iterator iter = | 1196 ClientIdToShaderCacheMap::iterator iter = |
| 1199 client_id_to_shader_cache_.find(client_id); | 1197 client_id_to_shader_cache_.find(client_id); |
| 1200 // If the cache doesn't exist then this is an off the record profile. | 1198 // If the cache doesn't exist then this is an off the record profile. |
| 1201 if (iter == client_id_to_shader_cache_.end()) | 1199 if (iter == client_id_to_shader_cache_.end()) |
| 1202 return; | 1200 return; |
| 1203 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1201 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1204 } | 1202 } |
| 1205 | 1203 |
| 1206 } // namespace content | 1204 } // namespace content |
| OLD | NEW |