Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1965)

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 1730023004: Revert of Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 #include "components/tracing/tracing_switches.h" 24 #include "components/tracing/tracing_switches.h"
25 #include "content/browser/browser_child_process_host_impl.h" 25 #include "content/browser/browser_child_process_host_impl.h"
26 #include "content/browser/gpu/compositor_util.h" 26 #include "content/browser/gpu/compositor_util.h"
27 #include "content/browser/gpu/gpu_data_manager_impl.h" 27 #include "content/browser/gpu/gpu_data_manager_impl.h"
28 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 28 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
29 #include "content/browser/gpu/gpu_surface_tracker.h" 29 #include "content/browser/gpu/gpu_surface_tracker.h"
30 #include "content/browser/gpu/shader_disk_cache.h" 30 #include "content/browser/gpu/shader_disk_cache.h"
31 #include "content/browser/mojo/mojo_application_host.h" 31 #include "content/browser/mojo/mojo_application_host.h"
32 #include "content/browser/renderer_host/render_widget_host_impl.h" 32 #include "content/browser/renderer_host/render_widget_host_impl.h"
33 #include "content/common/child_process_host_impl.h" 33 #include "content/common/child_process_host_impl.h"
34 #include "content/common/gpu/gpu_host_messages.h" 34 #include "content/common/gpu/gpu_messages.h"
35 #include "content/common/in_process_child_thread_params.h" 35 #include "content/common/in_process_child_thread_params.h"
36 #include "content/common/view_messages.h" 36 #include "content/common/view_messages.h"
37 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
38 #include "content/public/browser/content_browser_client.h" 38 #include "content/public/browser/content_browser_client.h"
39 #include "content/public/browser/render_process_host.h" 39 #include "content/public/browser/render_process_host.h"
40 #include "content/public/browser/render_widget_host_view.h" 40 #include "content/public/browser/render_widget_host_view.h"
41 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 41 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
42 #include "content/public/common/content_client.h" 42 #include "content/public/common/content_client.h"
43 #include "content/public/common/content_switches.h" 43 #include "content/public/common/content_switches.h"
44 #include "content/public/common/result_codes.h" 44 #include "content/public/common/result_codes.h"
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 OnDidCreateOffscreenContext) 608 OnDidCreateOffscreenContext)
609 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) 609 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext)
610 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, 610 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext,
611 OnDidDestroyOffscreenContext) 611 OnDidDestroyOffscreenContext)
612 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, 612 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats,
613 OnGpuMemoryUmaStatsReceived) 613 OnGpuMemoryUmaStatsReceived)
614 #if defined(OS_MACOSX) 614 #if defined(OS_MACOSX)
615 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 615 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
616 OnAcceleratedSurfaceBuffersSwapped(message)) 616 OnAcceleratedSurfaceBuffersSwapped(message))
617 #endif 617 #endif
618 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel, OnDestroyChannel) 618 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel,
619 IPC_MESSAGE_HANDLER(GpuHostMsg_CacheShader, OnCacheShader) 619 OnDestroyChannel)
620 IPC_MESSAGE_HANDLER(GpuHostMsg_CacheShader,
621 OnCacheShader)
620 #if defined(OS_WIN) 622 #if defined(OS_WIN)
621 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceCreatedChildWindow, 623 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceCreatedChildWindow,
622 OnAcceleratedSurfaceCreatedChildWindow) 624 OnAcceleratedSurfaceCreatedChildWindow)
623 #endif 625 #endif
624 626
625 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) 627 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
626 IPC_END_MESSAGE_MAP() 628 IPC_END_MESSAGE_MAP()
627 629
628 return true; 630 return true;
629 } 631 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 DCHECK(CalledOnValidThread()); 682 DCHECK(CalledOnValidThread());
681 TRACE_EVENT0("gpu", "GpuProcessHost::EstablishGpuChannel"); 683 TRACE_EVENT0("gpu", "GpuProcessHost::EstablishGpuChannel");
682 684
683 // If GPU features are already blacklisted, no need to establish the channel. 685 // If GPU features are already blacklisted, no need to establish the channel.
684 if (!GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { 686 if (!GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) {
685 DVLOG(1) << "GPU blacklisted, refusing to open a GPU channel."; 687 DVLOG(1) << "GPU blacklisted, refusing to open a GPU channel.";
686 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); 688 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo());
687 return; 689 return;
688 } 690 }
689 691
690 EstablishChannelParams params; 692 GpuMsg_EstablishChannel_Params params;
691 params.client_id = client_id; 693 params.client_id = client_id;
692 params.client_tracing_id = client_tracing_id; 694 params.client_tracing_id = client_tracing_id;
693 params.preempts = preempts; 695 params.preempts = preempts;
694 params.allow_view_command_buffers = allow_view_command_buffers; 696 params.allow_view_command_buffers = allow_view_command_buffers;
695 params.allow_real_time_streams = allow_real_time_streams; 697 params.allow_real_time_streams = allow_real_time_streams;
696 if (Send(new GpuMsg_EstablishChannel(params))) { 698 if (Send(new GpuMsg_EstablishChannel(params))) {
697 channel_requests_.push(callback); 699 channel_requests_.push(callback);
698 } else { 700 } else {
699 DVLOG(1) << "Failed to send GpuMsg_EstablishChannel."; 701 DVLOG(1) << "Failed to send GpuMsg_EstablishChannel.";
700 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); 702 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 780 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
779 } 781 }
780 782
781 void GpuProcessHost::OnChannelEstablished( 783 void GpuProcessHost::OnChannelEstablished(
782 const IPC::ChannelHandle& channel_handle) { 784 const IPC::ChannelHandle& channel_handle) {
783 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); 785 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished");
784 786
785 if (channel_requests_.empty()) { 787 if (channel_requests_.empty()) {
786 // This happens when GPU process is compromised. 788 // This happens when GPU process is compromised.
787 RouteOnUIThread(GpuHostMsg_OnLogMessage( 789 RouteOnUIThread(GpuHostMsg_OnLogMessage(
788 logging::LOG_WARNING, "WARNING", 790 logging::LOG_WARNING,
791 "WARNING",
789 "Received a ChannelEstablished message but no requests in queue.")); 792 "Received a ChannelEstablished message but no requests in queue."));
790 return; 793 return;
791 } 794 }
792 EstablishChannelCallback callback = channel_requests_.front(); 795 EstablishChannelCallback callback = channel_requests_.front();
793 channel_requests_.pop(); 796 channel_requests_.pop();
794 797
795 // Currently if any of the GPU features are blacklisted, we don't establish a 798 // Currently if any of the GPU features are blacklisted, we don't establish a
796 // GPU channel. 799 // GPU channel.
797 if (!channel_handle.name.empty() && 800 if (!channel_handle.name.empty() &&
798 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { 801 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) {
799 Send(new GpuMsg_CloseChannel(channel_handle)); 802 Send(new GpuMsg_CloseChannel(channel_handle));
800 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); 803 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo());
801 RouteOnUIThread( 804 RouteOnUIThread(GpuHostMsg_OnLogMessage(
802 GpuHostMsg_OnLogMessage(logging::LOG_WARNING, "WARNING", 805 logging::LOG_WARNING,
803 "Hardware acceleration is unavailable.")); 806 "WARNING",
807 "Hardware acceleration is unavailable."));
804 return; 808 return;
805 } 809 }
806 810
807 callback.Run(channel_handle, gpu_info_); 811 callback.Run(channel_handle, gpu_info_);
808 } 812 }
809 813
810 void GpuProcessHost::OnGpuMemoryBufferCreated( 814 void GpuProcessHost::OnGpuMemoryBufferCreated(
811 const gfx::GpuMemoryBufferHandle& handle) { 815 const gfx::GpuMemoryBufferHandle& handle) {
812 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); 816 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated");
813 817
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1147 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1144 ClientIdToShaderCacheMap::iterator iter = 1148 ClientIdToShaderCacheMap::iterator iter =
1145 client_id_to_shader_cache_.find(client_id); 1149 client_id_to_shader_cache_.find(client_id);
1146 // If the cache doesn't exist then this is an off the record profile. 1150 // If the cache doesn't exist then this is an off the record profile.
1147 if (iter == client_id_to_shader_cache_.end()) 1151 if (iter == client_id_to_shader_cache_.end())
1148 return; 1152 return;
1149 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1153 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1150 } 1154 }
1151 1155
1152 } // namespace content 1156 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698