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

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

Issue 2777973002: gpu: Replace GpuHostMsg_Initialized with mojom api. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu_host_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 } 696 }
697 697
698 void GpuProcessHost::AddFilter(IPC::MessageFilter* filter) { 698 void GpuProcessHost::AddFilter(IPC::MessageFilter* filter) {
699 DCHECK(CalledOnValidThread()); 699 DCHECK(CalledOnValidThread());
700 process_->GetHost()->AddFilter(filter); 700 process_->GetHost()->AddFilter(filter);
701 } 701 }
702 702
703 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { 703 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
704 DCHECK(CalledOnValidThread()); 704 DCHECK(CalledOnValidThread());
705 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 705 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
706 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized)
707 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated, 706 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated,
708 OnGpuMemoryBufferCreated) 707 OnGpuMemoryBufferCreated)
709 IPC_MESSAGE_HANDLER(GpuHostMsg_FieldTrialActivated, OnFieldTrialActivated); 708 IPC_MESSAGE_HANDLER(GpuHostMsg_FieldTrialActivated, OnFieldTrialActivated);
710 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) 709 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
711 IPC_END_MESSAGE_MAP() 710 IPC_END_MESSAGE_MAP()
712 711
713 return true; 712 return true;
714 } 713 }
715 714
716 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) { 715 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 TRACE_EVENT0("gpu", "GpuProcessHost::SendDestroyingVideoSurface"); 796 TRACE_EVENT0("gpu", "GpuProcessHost::SendDestroyingVideoSurface");
798 DCHECK(send_destroying_video_surface_done_cb_.is_null()); 797 DCHECK(send_destroying_video_surface_done_cb_.is_null());
799 DCHECK(!done_cb.is_null()); 798 DCHECK(!done_cb.is_null());
800 send_destroying_video_surface_done_cb_ = done_cb; 799 send_destroying_video_surface_done_cb_ = done_cb;
801 gpu_service_ptr_->DestroyingVideoSurface( 800 gpu_service_ptr_->DestroyingVideoSurface(
802 surface_id, base::Bind(&GpuProcessHost::OnDestroyingVideoSurfaceAck, 801 surface_id, base::Bind(&GpuProcessHost::OnDestroyingVideoSurfaceAck,
803 weak_ptr_factory_.GetWeakPtr())); 802 weak_ptr_factory_.GetWeakPtr()));
804 } 803 }
805 #endif 804 #endif
806 805
807 void GpuProcessHost::OnInitialized(
808 bool result,
809 const gpu::GPUInfo& gpu_info,
810 const gpu::GpuFeatureInfo& gpu_feature_info) {
811 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result);
812 initialized_ = result;
813 gpu_info_ = gpu_info;
814
815 if (!initialized_) {
816 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure();
817 return;
818 }
819 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
820 GpuDataManagerImpl::GetInstance()->UpdateGpuFeatureInfo(gpu_feature_info);
821 }
822
823 void GpuProcessHost::OnChannelEstablished( 806 void GpuProcessHost::OnChannelEstablished(
824 int client_id, 807 int client_id,
825 const EstablishChannelCallback& callback, 808 const EstablishChannelCallback& callback,
826 mojo::ScopedMessagePipeHandle channel_handle) { 809 mojo::ScopedMessagePipeHandle channel_handle) {
827 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); 810 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished");
828 DCHECK(!channel_requests_.empty()); 811 DCHECK(!channel_requests_.empty());
829 DCHECK(channel_requests_.front().Equals(callback)); 812 DCHECK(channel_requests_.front().Equals(callback));
830 channel_requests_.pop(); 813 channel_requests_.pop();
831 814
832 // Currently if any of the GPU features are blacklisted, we don't establish a 815 // Currently if any of the GPU features are blacklisted, we don't establish a
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 } 881 }
899 SendOutstandingReplies(); 882 SendOutstandingReplies();
900 RecordProcessCrash(); 883 RecordProcessCrash();
901 GpuDataManagerImpl::GetInstance()->ProcessCrashed( 884 GpuDataManagerImpl::GetInstance()->ProcessCrashed(
902 process_->GetTerminationStatus(true /* known_dead */, NULL)); 885 process_->GetTerminationStatus(true /* known_dead */, NULL));
903 } 886 }
904 887
905 void GpuProcessHost::DidInitialize( 888 void GpuProcessHost::DidInitialize(
906 const gpu::GPUInfo& gpu_info, 889 const gpu::GPUInfo& gpu_info,
907 const gpu::GpuFeatureInfo& gpu_feature_info) { 890 const gpu::GpuFeatureInfo& gpu_feature_info) {
908 // TODO(sad): This should call OnInitialized(). 891 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", true);
892 initialized_ = true;
893 gpu_info_ = gpu_info;
894 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
895 GpuDataManagerImpl::GetInstance()->UpdateGpuFeatureInfo(gpu_feature_info);
909 } 896 }
910 897
911 void GpuProcessHost::DidFailInitialize() { 898 void GpuProcessHost::DidFailInitialize() {
912 // TODO(sad): This should call GpuDataManagerImpl::OnGpuProcessInitFailure(). 899 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", false);
900 initialized_ = false;
901 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure();
913 } 902 }
914 903
915 void GpuProcessHost::DidCreateOffscreenContext(const GURL& url) { 904 void GpuProcessHost::DidCreateOffscreenContext(const GURL& url) {
916 urls_with_live_offscreen_contexts_.insert(url); 905 urls_with_live_offscreen_contexts_.insert(url);
917 } 906 }
918 907
919 void GpuProcessHost::DidDestroyOffscreenContext(const GURL& url) { 908 void GpuProcessHost::DidDestroyOffscreenContext(const GURL& url) {
920 urls_with_live_offscreen_contexts_.erase(url); 909 urls_with_live_offscreen_contexts_.erase(url);
921 } 910 }
922 911
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 GetShaderCacheFactorySingleton()->Get(client_id); 1248 GetShaderCacheFactorySingleton()->Get(client_id);
1260 if (!cache.get()) 1249 if (!cache.get())
1261 return; 1250 return;
1262 1251
1263 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); 1252 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_));
1264 1253
1265 client_id_to_shader_cache_[client_id] = cache; 1254 client_id_to_shader_cache_[client_id] = cache;
1266 } 1255 }
1267 1256
1268 } // namespace content 1257 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698