Index: content/common/gpu/client/gpu_channel_host.cc |
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc |
index be28c50c73e3ac2de6b926a4195b1f0c0ebc5715..72e89910316edb0998f57fa555c53465215dfa01 100644 |
--- a/content/common/gpu/client/gpu_channel_host.cc |
+++ b/content/common/gpu/client/gpu_channel_host.cc |
@@ -30,6 +30,16 @@ GpuListenerInfo::GpuListenerInfo() {} |
GpuListenerInfo::~GpuListenerInfo() {} |
+ProxyFlushInfo::ProxyFlushInfo() |
+ : flush_pending(false), |
+ route_id(MSG_ROUTING_NONE), |
+ put_offset(0), |
+ flush_count(0) { |
+} |
+ |
+ProxyFlushInfo::~ProxyFlushInfo() { |
+} |
+ |
// static |
scoped_refptr<GpuChannelHost> GpuChannelHost::Create( |
GpuChannelHostFactory* factory, |
@@ -112,6 +122,39 @@ bool GpuChannelHost::Send(IPC::Message* msg) { |
return false; |
} |
+void GpuChannelHost::OrderingBarrier( |
+ int route_id, |
+ int32 put_offset, |
+ unsigned int flush_count, |
+ const std::vector<ui::LatencyInfo>& latency_info, |
+ bool put_offset_changed, |
+ bool do_flush) { |
+ AutoLock lock(context_lock_); |
+ if (flush_info_.flush_pending && flush_info_.route_id != route_id) |
+ InternalFlush(); |
+ |
+ if (put_offset_changed) { |
+ flush_info_.flush_pending = true; |
+ flush_info_.route_id = route_id; |
+ flush_info_.put_offset = put_offset; |
+ flush_info_.flush_count = flush_count; |
+ flush_info_.latency_info.insert(flush_info_.latency_info.end(), |
+ latency_info.begin(), latency_info.end()); |
+ |
+ if (do_flush) |
+ InternalFlush(); |
+ } |
+} |
+ |
+void GpuChannelHost::InternalFlush() { |
+ DCHECK(flush_info_.flush_pending); |
+ Send(new GpuCommandBufferMsg_AsyncFlush( |
+ flush_info_.route_id, flush_info_.put_offset, flush_info_.flush_count, |
+ flush_info_.latency_info)); |
+ flush_info_.latency_info.clear(); |
+ flush_info_.flush_pending = false; |
+} |
+ |
CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( |
int32 surface_id, |
CommandBufferProxyImpl* share_group, |
@@ -178,10 +221,8 @@ CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer( |
init_params.gpu_preference = gpu_preference; |
int32 route_id = GenerateRouteID(); |
bool succeeded = false; |
- if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, |
- init_params, |
- route_id, |
- &succeeded))) { |
+ if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer( |
+ size, init_params, route_id, &succeeded))) { |
LOG(ERROR) << "Failed to send GpuChannelMsg_CreateOffscreenCommandBuffer."; |
return NULL; |
} |
@@ -229,6 +270,9 @@ void GpuChannelHost::DestroyCommandBuffer( |
AutoLock lock(context_lock_); |
proxies_.erase(route_id); |
+ if (flush_info_.flush_pending && flush_info_.route_id == route_id) |
+ flush_info_.flush_pending = false; |
+ |
delete command_buffer; |
} |