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

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

Issue 23843005: Report accelerated surface vsync time info to browser compositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/common/gpu/gpu_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 "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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 CauseForGpuLaunch cause, 73 CauseForGpuLaunch cause,
74 IPC::Message* message) { 74 IPC::Message* message) {
75 GpuProcessHost* host = GpuProcessHost::Get(kind, cause); 75 GpuProcessHost* host = GpuProcessHost::Get(kind, cause);
76 if (host) { 76 if (host) {
77 host->Send(message); 77 host->Send(message);
78 } else { 78 } else {
79 delete message; 79 delete message;
80 } 80 }
81 } 81 }
82 82
83 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id, 83 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(
84 int route_id, 84 int host_id,
85 bool alive) { 85 int route_id,
86 bool alive,
87 base::TimeTicks vsync_timebase,
88 base::TimeDelta vsync_interval) {
86 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 89 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
87 BrowserThread::PostTask( 90 BrowserThread::PostTask(
88 BrowserThread::IO, 91 BrowserThread::IO,
89 FROM_HERE, 92 FROM_HERE,
90 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 93 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
91 host_id, 94 host_id,
92 route_id, 95 route_id,
93 alive)); 96 alive,
97 vsync_timebase,
98 vsync_interval));
94 return; 99 return;
95 } 100 }
96 101
97 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 102 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
98 if (host) { 103 if (host) {
99 if (alive) { 104 if (alive) {
100 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 105 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
101 ack_params.sync_point = 0; 106 ack_params.sync_point = 0;
107 #if defined(OS_WIN)
108 ack_params.vsync_timebase = vsync_timebase;
109 ack_params.vsync_interval = vsync_interval;
110 #endif
102 host->Send( 111 host->Send(
103 new AcceleratedSurfaceMsg_BufferPresented(route_id, ack_params)); 112 new AcceleratedSurfaceMsg_BufferPresented(route_id, ack_params));
104 } else { 113 } else {
105 host->ForceShutdown(); 114 host->ForceShutdown();
106 } 115 }
107 } 116 }
108 } 117 }
109 118
110 #if defined(OS_WIN) 119 #if defined(OS_WIN)
111 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process 120 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 152 }
144 153
145 void AcceleratedSurfaceBuffersSwappedCompleted( 154 void AcceleratedSurfaceBuffersSwappedCompleted(
146 int host_id, 155 int host_id,
147 int route_id, 156 int route_id,
148 int surface_id, 157 int surface_id,
149 bool alive, 158 bool alive,
150 base::TimeTicks timebase, 159 base::TimeTicks timebase,
151 base::TimeDelta interval, 160 base::TimeDelta interval,
152 const ui::LatencyInfo& latency_info) { 161 const ui::LatencyInfo& latency_info) {
153 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id, 162 AcceleratedSurfaceBuffersSwappedCompletedForGPU(
154 alive); 163 host_id, route_id, alive, timebase, interval);
155 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase, 164 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(
156 interval, latency_info); 165 surface_id, timebase, interval, latency_info);
157 } 166 }
158 167
159 // NOTE: changes to this class need to be reviewed by the security team. 168 // NOTE: changes to this class need to be reviewed by the security team.
160 class GpuSandboxedProcessLauncherDelegate 169 class GpuSandboxedProcessLauncherDelegate
161 : public SandboxedProcessLauncherDelegate { 170 : public SandboxedProcessLauncherDelegate {
162 public: 171 public:
163 explicit GpuSandboxedProcessLauncherDelegate(CommandLine* cmd_line) 172 explicit GpuSandboxedProcessLauncherDelegate(CommandLine* cmd_line)
164 : cmd_line_(cmd_line) {} 173 : cmd_line_(cmd_line) {}
165 virtual ~GpuSandboxedProcessLauncherDelegate() {} 174 virtual ~GpuSandboxedProcessLauncherDelegate() {}
166 175
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 // plugin windows. 884 // plugin windows.
876 if (surface_handle.handle != gfx::kNullPluginWindow || 885 if (surface_handle.handle != gfx::kNullPluginWindow ||
877 surface_handle.transport_type == gfx::TEXTURE_TRANSPORT) { 886 surface_handle.transport_type == gfx::TEXTURE_TRANSPORT) {
878 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 887 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
879 return; 888 return;
880 } 889 }
881 890
882 base::ScopedClosureRunner scoped_completion_runner( 891 base::ScopedClosureRunner scoped_completion_runner(
883 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 892 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
884 host_id_, params.route_id, 893 host_id_, params.route_id,
885 true /* alive */)); 894 true /* alive */, base::TimeTicks(), base::TimeDelta()));
886 895
887 int render_process_id = 0; 896 int render_process_id = 0;
888 int render_widget_id = 0; 897 int render_widget_id = 0;
889 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 898 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
890 params.surface_id, &render_process_id, &render_widget_id)) { 899 params.surface_id, &render_process_id, &render_widget_id)) {
891 return; 900 return;
892 } 901 }
893 RenderWidgetHelper* helper = 902 RenderWidgetHelper* helper =
894 RenderWidgetHelper::FromProcessHostID(render_process_id); 903 RenderWidgetHelper::FromProcessHostID(render_process_id);
895 if (!helper) 904 if (!helper)
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1250 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1242 ClientIdToShaderCacheMap::iterator iter = 1251 ClientIdToShaderCacheMap::iterator iter =
1243 client_id_to_shader_cache_.find(client_id); 1252 client_id_to_shader_cache_.find(client_id);
1244 // If the cache doesn't exist then this is an off the record profile. 1253 // If the cache doesn't exist then this is an off the record profile.
1245 if (iter == client_id_to_shader_cache_.end()) 1254 if (iter == client_id_to_shader_cache_.end())
1246 return; 1255 return;
1247 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1256 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1248 } 1257 }
1249 1258
1250 } // namespace content 1259 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698