summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
Diffstat (limited to 'content/common')
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.cc19
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.h7
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc5
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.h2
-rw-r--r--content/common/gpu/gpu_messages.h9
-rw-r--r--content/common/gpu/image_transport_surface.cc8
-rw-r--r--content/common/gpu/image_transport_surface.h2
7 files changed, 42 insertions, 10 deletions
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index a0f67b3..f25120c 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -47,6 +47,8 @@ bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) {
OnSetMemoryAllocation);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck,
OnSignalSyncPointAck);
+ IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffersCompleted,
+ OnSwapBuffersCompleted);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -192,6 +194,11 @@ void CommandBufferProxyImpl::SetLatencyInfo(
latency_info_.push_back(latency_info[i]);
}
+void CommandBufferProxyImpl::SetSwapBuffersCompletionCallback(
+ const SwapBuffersCompletionCallback& callback) {
+ swap_buffers_completion_callback_ = callback;
+}
+
void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) {
TRACE_EVENT2("gpu",
"CommandBufferProxyImpl::WaitForToken",
@@ -504,4 +511,16 @@ gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const {
shared_state_shm_->memory());
}
+void CommandBufferProxyImpl::OnSwapBuffersCompleted(
+ const std::vector<ui::LatencyInfo>& latency_info) {
+ if (!swap_buffers_completion_callback_.is_null()) {
+ if (!ui::LatencyInfo::Verify(
+ latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) {
+ swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>());
+ return;
+ }
+ swap_buffers_completion_callback_.Run(latency_info);
+ }
+}
+
} // namespace content
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h
index 64474be..1ff5d0d 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.h
+++ b/content/common/gpu/client/command_buffer_proxy_impl.h
@@ -131,6 +131,10 @@ class CommandBufferProxyImpl
const GpuConsoleMessageCallback& callback);
void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info);
+ typedef base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info)>
+ SwapBuffersCompletionCallback;
+ void SetSwapBuffersCompletionCallback(
+ const SwapBuffersCompletionCallback& callback);
// TODO(apatrick): this is a temporary optimization while skia is calling
// ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6
@@ -161,6 +165,7 @@ class CommandBufferProxyImpl
void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message);
void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation);
void OnSignalSyncPointAck(uint32 id);
+ void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info);
// Try to read an updated copy of the state from shared memory.
void TryUpdateState();
@@ -201,6 +206,8 @@ class CommandBufferProxyImpl
std::vector<ui::LatencyInfo> latency_info_;
+ SwapBuffersCompletionCallback swap_buffers_completion_callback_;
+
DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl);
};
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 94c598c..89bc97e 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -1096,4 +1096,9 @@ uint64 GpuCommandBufferStub::GetMemoryUsage() const {
return GetMemoryManager()->GetClientMemoryUsage(this);
}
+void GpuCommandBufferStub::SwapBuffersCompleted(
+ const std::vector<ui::LatencyInfo>& latency_info) {
+ Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info));
+}
+
} // namespace content
diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h
index 7db3a05..10142f2 100644
--- a/content/common/gpu/gpu_command_buffer_stub.h
+++ b/content/common/gpu/gpu_command_buffer_stub.h
@@ -144,6 +144,8 @@ class GpuCommandBufferStub
uint64 GetMemoryUsage() const;
+ void SwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info);
+
private:
GpuMemoryManager* GetMemoryManager() const;
bool MakeCurrent();
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index b42bc09..d9301c9 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -378,11 +378,6 @@ IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized,
int32 /* surface_id */,
int32 /* route_id */)
-// Tells the browser that a frame with the specific latency info was drawn to
-// the screen
-IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn,
- std::vector<ui::LatencyInfo> /* latency_info */)
-
// Same as above with a rect of the part of the surface that changed.
IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
@@ -548,6 +543,10 @@ IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder,
IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed,
gpu::error::ContextLostReason /* reason */)
+// Tells the browser that SwapBuffers returned and passes latency info
+IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SwapBuffersCompleted,
+ std::vector<ui::LatencyInfo> /* latency_info */)
+
// Send to stub on surface visibility change.
IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */)
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index 94991a8..a1062dd 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -120,9 +120,9 @@ void ImageTransportHelper::SendUpdateVSyncParameters(
interval));
}
-void ImageTransportHelper::SendLatencyInfo(
+void ImageTransportHelper::SwapBuffersCompleted(
const std::vector<ui::LatencyInfo>& latency_info) {
- manager_->Send(new GpuHostMsg_FrameDrawn(latency_info));
+ stub_->SwapBuffersCompleted(latency_info);
}
void ImageTransportHelper::SetScheduled(bool is_scheduled) {
@@ -245,7 +245,7 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
}
- helper_->SendLatencyInfo(latency_info_);
+ helper_->SwapBuffersCompleted(latency_info_);
latency_info_.clear();
return result;
}
@@ -259,7 +259,7 @@ bool PassThroughImageTransportSurface::PostSubBuffer(
ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
}
- helper_->SendLatencyInfo(latency_info_);
+ helper_->SwapBuffersCompleted(latency_info_);
latency_info_.clear();
return result;
}
diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h
index 111ac82..6016c84 100644
--- a/content/common/gpu/image_transport_surface.h
+++ b/content/common/gpu/image_transport_surface.h
@@ -127,7 +127,7 @@ class ImageTransportHelper
void SendUpdateVSyncParameters(
base::TimeTicks timebase, base::TimeDelta interval);
- void SendLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info);
+ void SwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info);
// Whether or not we should execute more commands.
void SetScheduled(bool is_scheduled);