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.cc8
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.h7
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc6
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.h4
-rw-r--r--content/common/gpu/gpu_messages.h7
-rw-r--r--content/common/gpu/image_transport_surface.cc29
-rw-r--r--content/common/gpu/image_transport_surface.h8
-rw-r--r--content/common/gpu/image_transport_surface_android.cc4
-rw-r--r--content/common/gpu/image_transport_surface_fbo_mac.h4
-rw-r--r--content/common/gpu/image_transport_surface_fbo_mac.mm14
-rw-r--r--content/common/gpu/image_transport_surface_mac.mm6
-rw-r--r--content/common/gpu/null_transport_surface.cc12
-rw-r--r--content/common/gpu/null_transport_surface.h4
13 files changed, 70 insertions, 43 deletions
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 8ca94b3..36e6459 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -598,14 +598,16 @@ gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const {
}
void CommandBufferProxyImpl::OnSwapBuffersCompleted(
- const std::vector<ui::LatencyInfo>& latency_info) {
+ const std::vector<ui::LatencyInfo>& latency_info,
+ gfx::SwapResult result) {
if (!swap_buffers_completion_callback_.is_null()) {
if (!ui::LatencyInfo::Verify(
latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) {
- swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>());
+ swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>(),
+ result);
return;
}
- swap_buffers_completion_callback_.Run(latency_info);
+ swap_buffers_completion_callback_.Run(latency_info, result);
}
}
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h
index 4bd2006b..9f85bb2 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.h
+++ b/content/common/gpu/client/command_buffer_proxy_impl.h
@@ -22,6 +22,7 @@
#include "gpu/command_buffer/common/gpu_memory_allocation.h"
#include "ipc/ipc_listener.h"
#include "ui/events/latency_info.h"
+#include "ui/gfx/swap_result.h"
struct GPUCommandBufferConsoleMessage;
@@ -136,7 +137,8 @@ class CommandBufferProxyImpl
void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info);
using SwapBuffersCompletionCallback =
- base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info)>;
+ base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info,
+ gfx::SwapResult result)>;
void SetSwapBuffersCompletionCallback(
const SwapBuffersCompletionCallback& callback);
@@ -180,7 +182,8 @@ 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);
+ void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info,
+ gfx::SwapResult result);
void OnUpdateVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval);
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index bb4044a..729f66d 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -1107,8 +1107,10 @@ uint64 GpuCommandBufferStub::GetMemoryUsage() const {
}
void GpuCommandBufferStub::SendSwapBuffersCompleted(
- const std::vector<ui::LatencyInfo>& latency_info) {
- Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info));
+ const std::vector<ui::LatencyInfo>& latency_info,
+ gfx::SwapResult result) {
+ Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info,
+ result));
}
void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h
index c9e215c..24ba37a 100644
--- a/content/common/gpu/gpu_command_buffer_stub.h
+++ b/content/common/gpu/gpu_command_buffer_stub.h
@@ -27,6 +27,7 @@
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/swap_result.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gpu_preference.h"
#include "url/gurl.h"
@@ -148,7 +149,8 @@ class GpuCommandBufferStub
uint64 GetMemoryUsage() const;
void SendSwapBuffersCompleted(
- const std::vector<ui::LatencyInfo>& latency_info);
+ const std::vector<ui::LatencyInfo>& latency_info,
+ gfx::SwapResult result);
void SendUpdateVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval);
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 6bdec50..2f30dac 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -33,6 +33,7 @@
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/swap_result.h"
#include "ui/gl/gpu_preference.h"
#if defined(OS_ANDROID)
@@ -52,6 +53,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
gfx::GpuPreferenceLast)
IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType,
gfx::SURFACE_TYPE_LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult, gfx::SwapResult::SWAP_RESULT_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
gpu::MemoryAllocation::CUTOFF_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error, gpu::error::kErrorLast)
@@ -558,8 +560,9 @@ IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed,
gpu::error::Error /* error */)
// Tells the browser that SwapBuffers returned and passes latency info
-IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SwapBuffersCompleted,
- std::vector<ui::LatencyInfo> /* latency_info */)
+IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SwapBuffersCompleted,
+ std::vector<ui::LatencyInfo> /* latency_info */,
+ gfx::SwapResult /* result */)
// Tells the browser about updated parameters for vsync alignment.
IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters,
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index ac5eb2e..6d2808f 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -187,7 +187,7 @@ void PassThroughImageTransportSurface::SetLatencyInfo(
latency_info_.push_back(latency_info[i]);
}
-bool PassThroughImageTransportSurface::SwapBuffers() {
+gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() {
// GetVsyncValues before SwapBuffers to work around Mali driver bug:
// crbug.com/223558.
SendVSyncUpdateIfAvailable();
@@ -206,12 +206,16 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
new std::vector<ui::LatencyInfo>();
latency_info_ptr->swap(latency_info_);
return gfx::GLSurfaceAdapter::SwapBuffersAsync(base::Bind(
- &PassThroughImageTransportSurface::SwapBuffersCallBack,
- weak_ptr_factory_.GetWeakPtr(), base::Owned(latency_info_ptr)));
+ &PassThroughImageTransportSurface::SwapBuffersCallBack,
+ weak_ptr_factory_.GetWeakPtr(), base::Owned(latency_info_ptr)))
+ ? gfx::SwapResult::SWAP_ACK
+ : gfx::SwapResult::SWAP_FAILED;
}
-bool PassThroughImageTransportSurface::PostSubBuffer(
- int x, int y, int width, int height) {
+gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x,
+ int y,
+ int width,
+ int height) {
SendVSyncUpdateIfAvailable();
base::TimeTicks swap_time = base::TimeTicks::Now();
@@ -228,14 +232,17 @@ bool PassThroughImageTransportSurface::PostSubBuffer(
new std::vector<ui::LatencyInfo>();
latency_info_ptr->swap(latency_info_);
return gfx::GLSurfaceAdapter::PostSubBufferAsync(
- x, y, width, height,
- base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack,
- weak_ptr_factory_.GetWeakPtr(),
- base::Owned(latency_info_ptr)));
+ x, y, width, height,
+ base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Owned(latency_info_ptr)))
+ ? gfx::SwapResult::SWAP_ACK
+ : gfx::SwapResult::SWAP_FAILED;
}
void PassThroughImageTransportSurface::SwapBuffersCallBack(
- std::vector<ui::LatencyInfo>* latency_info_ptr) {
+ std::vector<ui::LatencyInfo>* latency_info_ptr,
+ gfx::SwapResult result) {
base::TimeTicks swap_ack_time = base::TimeTicks::Now();
for (auto& latency : *latency_info_ptr) {
latency.AddLatencyNumberWithTimestamp(
@@ -243,7 +250,7 @@ void PassThroughImageTransportSurface::SwapBuffersCallBack(
swap_ack_time, 1);
}
- helper_->stub()->SendSwapBuffersCompleted(*latency_info_ptr);
+ helper_->stub()->SendSwapBuffersCompleted(*latency_info_ptr, result);
}
bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h
index d3f2e85..c0bceab 100644
--- a/content/common/gpu/image_transport_surface.h
+++ b/content/common/gpu/image_transport_surface.h
@@ -19,6 +19,7 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/swap_result.h"
#include "ui/gl/gl_surface.h"
struct AcceleratedSurfaceMsg_BufferPresented_Params;
@@ -175,8 +176,8 @@ class PassThroughImageTransportSurface
// GLSurface implementation.
bool Initialize() override;
void Destroy() override;
- bool SwapBuffers() override;
- bool PostSubBuffer(int x, int y, int width, int height) override;
+ gfx::SwapResult SwapBuffers() override;
+ gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
bool OnMakeCurrent(gfx::GLContext* context) override;
// ImageTransportSurface implementation.
@@ -196,7 +197,8 @@ class PassThroughImageTransportSurface
// If updated vsync parameters can be determined, send this information to
// the browser.
virtual void SendVSyncUpdateIfAvailable();
- void SwapBuffersCallBack(std::vector<ui::LatencyInfo>* latency_info_ptr);
+ void SwapBuffersCallBack(std::vector<ui::LatencyInfo>* latency_info_ptr,
+ gfx::SwapResult result);
ImageTransportHelper* GetHelper() { return helper_.get(); }
diff --git a/content/common/gpu/image_transport_surface_android.cc b/content/common/gpu/image_transport_surface_android.cc
index 6d67df2..56030ef 100644
--- a/content/common/gpu/image_transport_surface_android.cc
+++ b/content/common/gpu/image_transport_surface_android.cc
@@ -59,7 +59,7 @@ class DirectSurfaceAndroid : public PassThroughImageTransportSurface {
gfx::GLSurface* surface);
// gfx::GLSurface implementation.
- bool SwapBuffers() override;
+ gfx::SwapResult SwapBuffers() override;
protected:
~DirectSurfaceAndroid() override;
@@ -123,7 +123,7 @@ DirectSurfaceAndroid::DirectSurfaceAndroid(GpuChannelManager* manager,
DirectSurfaceAndroid::~DirectSurfaceAndroid() {}
-bool DirectSurfaceAndroid::SwapBuffers() {
+gfx::SwapResult DirectSurfaceAndroid::SwapBuffers() {
DidAccessGpu();
return PassThroughImageTransportSurface::SwapBuffers();
}
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.h b/content/common/gpu/image_transport_surface_fbo_mac.h
index d5a0c20..d39e2459 100644
--- a/content/common/gpu/image_transport_surface_fbo_mac.h
+++ b/content/common/gpu/image_transport_surface_fbo_mac.h
@@ -71,8 +71,8 @@ class ImageTransportSurfaceFBO
void Destroy() override;
bool DeferDraws() override;
bool IsOffscreen() override;
- bool SwapBuffers() override;
- bool PostSubBuffer(int x, int y, int width, int height) override;
+ gfx::SwapResult SwapBuffers() override;
+ gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
bool SupportsPostSubBuffer() override;
gfx::Size GetSize() override;
void* GetHandle() override;
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.mm b/content/common/gpu/image_transport_surface_fbo_mac.mm
index f1aa838..102a6b3 100644
--- a/content/common/gpu/image_transport_surface_fbo_mac.mm
+++ b/content/common/gpu/image_transport_surface_fbo_mac.mm
@@ -169,9 +169,10 @@ void ImageTransportSurfaceFBO::AdjustBufferAllocation() {
}
}
-bool ImageTransportSurfaceFBO::SwapBuffers() {
+gfx::SwapResult ImageTransportSurfaceFBO::SwapBuffers() {
TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::SwapBuffers");
- return SwapBuffersInternal();
+ return SwapBuffersInternal() ? gfx::SwapResult::SWAP_ACK
+ : gfx::SwapResult::SWAP_FAILED;
}
bool ImageTransportSurfaceFBO::SwapBuffersInternal() {
@@ -208,10 +209,13 @@ void ImageTransportSurfaceFBO::SetRendererID(int renderer_id) {
context_->share_group()->SetRendererID(renderer_id);
}
-bool ImageTransportSurfaceFBO::PostSubBuffer(
- int x, int y, int width, int height) {
+gfx::SwapResult ImageTransportSurfaceFBO::PostSubBuffer(int x,
+ int y,
+ int width,
+ int height) {
TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::PostSubBuffer");
- return SwapBuffersInternal();
+ return SwapBuffersInternal() ? gfx::SwapResult::SWAP_ACK
+ : gfx::SwapResult::SWAP_FAILED;
}
bool ImageTransportSurfaceFBO::SupportsPostSubBuffer() {
diff --git a/content/common/gpu/image_transport_surface_mac.mm b/content/common/gpu/image_transport_surface_mac.mm
index 7966d5a..04b6bc3 100644
--- a/content/common/gpu/image_transport_surface_mac.mm
+++ b/content/common/gpu/image_transport_surface_mac.mm
@@ -28,15 +28,15 @@ class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa {
: GLSurfaceOSMesa(gfx::OSMesaSurfaceFormatRGBA, gfx::Size(1, 1)) {}
// Implement a subset of GLSurface.
- bool SwapBuffers() override;
+ gfx::SwapResult SwapBuffers() override;
private:
~DRTSurfaceOSMesa() override {}
DISALLOW_COPY_AND_ASSIGN(DRTSurfaceOSMesa);
};
-bool DRTSurfaceOSMesa::SwapBuffers() {
- return true;
+gfx::SwapResult DRTSurfaceOSMesa::SwapBuffers() {
+ return gfx::SwapResult::SWAP_ACK;
}
bool g_allow_os_mesa = false;
diff --git a/content/common/gpu/null_transport_surface.cc b/content/common/gpu/null_transport_surface.cc
index ebcea85..33521a0 100644
--- a/content/common/gpu/null_transport_surface.cc
+++ b/content/common/gpu/null_transport_surface.cc
@@ -49,15 +49,17 @@ void NullTransportSurface::Destroy() {
// Do not destroy |surface_| since we use the shared offscreen surface.
}
-bool NullTransportSurface::SwapBuffers() {
+gfx::SwapResult NullTransportSurface::SwapBuffers() {
NOTIMPLEMENTED();
- return false;
+ return gfx::SwapResult::SWAP_FAILED;
}
-bool NullTransportSurface::PostSubBuffer(
- int x, int y, int width, int height) {
+gfx::SwapResult NullTransportSurface::PostSubBuffer(int x,
+ int y,
+ int width,
+ int height) {
NOTIMPLEMENTED();
- return false;
+ return gfx::SwapResult::SWAP_FAILED;
}
void NullTransportSurface::SendVSyncUpdateIfAvailable() {
diff --git a/content/common/gpu/null_transport_surface.h b/content/common/gpu/null_transport_surface.h
index 53f86fc..8b78d15 100644
--- a/content/common/gpu/null_transport_surface.h
+++ b/content/common/gpu/null_transport_surface.h
@@ -23,8 +23,8 @@ class NullTransportSurface : public PassThroughImageTransportSurface {
// gfx::GLSurfaceAdapter implementation.
bool Initialize() override;
void Destroy() override;
- bool SwapBuffers() override;
- bool PostSubBuffer(int x, int y, int width, int height) override;
+ gfx::SwapResult SwapBuffers() override;
+ gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
bool OnMakeCurrent(gfx::GLContext* context) override;
protected: