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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 896 Send(new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
897 ack_params)); | 897 ack_params)); |
898 } | 898 } |
899 | 899 |
900 // Pass the SwapBuffers on to the RenderWidgetHelper to wake up the UI thread | 900 // Pass the SwapBuffers on to the RenderWidgetHelper to wake up the UI thread |
901 // if the browser is waiting for a new frame. Otherwise the RenderWidgetHelper | 901 // if the browser is waiting for a new frame. Otherwise the RenderWidgetHelper |
902 // will forward to the RenderWidgetHostView via RenderProcessHostImpl and | 902 // will forward to the RenderWidgetHostView via RenderProcessHostImpl and |
903 // RenderWidgetHostImpl. | 903 // RenderWidgetHostImpl. |
904 ViewHostMsg_CompositorSurfaceBuffersSwapped_Params view_params; | 904 ViewHostMsg_CompositorSurfaceBuffersSwapped_Params view_params; |
905 view_params.use_native_widget = native_widget; | 905 view_params.use_native_widget = native_widget; |
| 906 view_params.native_widget_token = native_widget ? |
| 907 RenderWidgetHelper::CreateNativeWidgetSwapToken() : 0; |
906 view_params.surface_id = params.surface_id; | 908 view_params.surface_id = params.surface_id; |
907 view_params.surface_handle = params.surface_handle; | 909 view_params.surface_handle = params.surface_handle; |
908 view_params.route_id = params.route_id; | 910 view_params.route_id = params.route_id; |
909 view_params.size = params.size; | 911 view_params.size = params.size; |
910 view_params.scale_factor = params.scale_factor; | 912 view_params.scale_factor = params.scale_factor; |
911 view_params.gpu_process_host_id = host_id_; | 913 view_params.gpu_process_host_id = host_id_; |
912 view_params.latency_info = params.latency_info; | 914 view_params.latency_info = params.latency_info; |
913 if (helper) { | 915 // Always post a task to handle native widget messages, in case the helper |
914 helper->DidReceiveBackingStoreMsg( | 916 // that the message is sent to is destroyed before the message is handled. |
915 ViewHostMsg_CompositorSurfaceBuffersSwapped( | 917 if (native_widget) { |
916 render_widget_id, | |
917 view_params)); | |
918 } else if (native_widget) { | |
919 BrowserThread::PostTask( | 918 BrowserThread::PostTask( |
920 BrowserThread::UI, | 919 BrowserThread::UI, |
921 FROM_HERE, | 920 FROM_HERE, |
922 base::Bind(&RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnUIThread, | 921 base::Bind(&RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnUIThread, |
923 view_params)); | 922 view_params)); |
924 } | 923 } |
| 924 if (helper) { |
| 925 helper->DidReceiveBackingStoreMsg( |
| 926 ViewHostMsg_CompositorSurfaceBuffersSwapped( |
| 927 render_widget_id, |
| 928 view_params)); |
| 929 } |
| 930 |
925 } | 931 } |
926 #endif // OS_MACOSX | 932 #endif // OS_MACOSX |
927 | 933 |
928 void GpuProcessHost::OnProcessLaunched() { | 934 void GpuProcessHost::OnProcessLaunched() { |
929 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime", | 935 UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime", |
930 base::TimeTicks::Now() - init_start_time_); | 936 base::TimeTicks::Now() - init_start_time_); |
931 } | 937 } |
932 | 938 |
933 void GpuProcessHost::OnProcessCrashed(int exit_code) { | 939 void GpuProcessHost::OnProcessCrashed(int exit_code) { |
934 SendOutstandingReplies(); | 940 SendOutstandingReplies(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1145 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1140 ClientIdToShaderCacheMap::iterator iter = | 1146 ClientIdToShaderCacheMap::iterator iter = |
1141 client_id_to_shader_cache_.find(client_id); | 1147 client_id_to_shader_cache_.find(client_id); |
1142 // If the cache doesn't exist then this is an off the record profile. | 1148 // If the cache doesn't exist then this is an off the record profile. |
1143 if (iter == client_id_to_shader_cache_.end()) | 1149 if (iter == client_id_to_shader_cache_.end()) |
1144 return; | 1150 return; |
1145 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1151 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1146 } | 1152 } |
1147 | 1153 |
1148 } // namespace content | 1154 } // namespace content |
OLD | NEW |