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 <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) | 629 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) |
630 IPC_END_MESSAGE_MAP() | 630 IPC_END_MESSAGE_MAP() |
631 | 631 |
632 return true; | 632 return true; |
633 } | 633 } |
634 | 634 |
635 #if defined(OS_WIN) | 635 #if defined(OS_WIN) |
636 void GpuProcessHost::OnAcceleratedSurfaceCreatedChildWindow( | 636 void GpuProcessHost::OnAcceleratedSurfaceCreatedChildWindow( |
637 const gfx::PluginWindowHandle& parent_handle, | 637 const gfx::PluginWindowHandle& parent_handle, |
638 const gfx::PluginWindowHandle& window_handle) { | 638 const gfx::PluginWindowHandle& window_handle) { |
639 DCHECK(process_); | 639 if (!in_process_) { |
640 { | 640 DCHECK(process_); |
641 DWORD process_id = 0; | 641 { |
642 DWORD thread_id = GetWindowThreadProcessId(parent_handle, &process_id); | 642 DWORD process_id = 0; |
| 643 DWORD thread_id = GetWindowThreadProcessId(parent_handle, &process_id); |
643 | 644 |
644 if (!thread_id || process_id != ::GetCurrentProcessId()) { | 645 if (!thread_id || process_id != ::GetCurrentProcessId()) { |
645 process_->TerminateOnBadMessageReceived( | 646 process_->TerminateOnBadMessageReceived( |
646 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); | 647 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); |
647 return; | 648 return; |
| 649 } |
648 } | 650 } |
649 } | |
650 { | |
651 DWORD process_id = 0; | |
652 DWORD thread_id = GetWindowThreadProcessId(window_handle, &process_id); | |
653 | 651 |
654 if (!thread_id || process_id != process_->GetProcess().Pid()) { | 652 { |
655 process_->TerminateOnBadMessageReceived( | 653 DWORD process_id = 0; |
656 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); | 654 DWORD thread_id = GetWindowThreadProcessId(window_handle, &process_id); |
657 return; | 655 |
| 656 if (!thread_id || process_id != process_->GetProcess().Pid()) { |
| 657 process_->TerminateOnBadMessageReceived( |
| 658 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); |
| 659 return; |
| 660 } |
658 } | 661 } |
659 } | 662 } |
660 | 663 |
661 ::SetParent(window_handle, parent_handle); | 664 ::SetParent(window_handle, parent_handle); |
662 } | 665 } |
663 #endif | 666 #endif |
664 | 667 |
665 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) { | 668 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) { |
666 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelConnected"); | 669 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelConnected"); |
667 | 670 |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1226 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1224 ClientIdToShaderCacheMap::iterator iter = | 1227 ClientIdToShaderCacheMap::iterator iter = |
1225 client_id_to_shader_cache_.find(client_id); | 1228 client_id_to_shader_cache_.find(client_id); |
1226 // If the cache doesn't exist then this is an off the record profile. | 1229 // If the cache doesn't exist then this is an off the record profile. |
1227 if (iter == client_id_to_shader_cache_.end()) | 1230 if (iter == client_id_to_shader_cache_.end()) |
1228 return; | 1231 return; |
1229 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1232 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1230 } | 1233 } |
1231 | 1234 |
1232 } // namespace content | 1235 } // namespace content |
OLD | NEW |