summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 12:19:29 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 12:19:29 +0000
commit36e5ff130092eb95bf734c39d15e1ae48fad1581 (patch)
tree63c4142ae12770156248e2c1c61fd4c93dd089a4 /cc
parentf74356578beb2e385a1bd5a1a26677ce058bc4bf (diff)
downloadchromium_src-36e5ff130092eb95bf734c39d15e1ae48fad1581.zip
chromium_src-36e5ff130092eb95bf734c39d15e1ae48fad1581.tar.gz
chromium_src-36e5ff130092eb95bf734c39d15e1ae48fad1581.tar.bz2
Unified OutputSurface::SwapBuffers.
This patch introduces a hard contract that CC will always call OutputSurface::SwapBuffers(), and OutputSurface will always respond with OutputSurfaceClient::OnSwapBuffersComplete(), in all rendering modes. I deleted the methods SendFrameToParentCompositor, PostSubBuffer, and OnSendFrameToParentCompositorAck, subsuming them into SwapBuffers. I also deleted all the settings and capabilities specifying which variant needed to be called. This should be a no-op for all graphics modes except for Android WebView, where it has the benefits of ensuring OnSwapBuffersComplete is called and that CompositorFrameMetadata is available even though no parent compositor exists. NOTRY=true BUG=237006 Review URL: https://chromiumcodereview.appspot.com/16304003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/output/delegating_renderer.cc8
-rw-r--r--cc/output/delegating_renderer.h5
-rw-r--r--cc/output/gl_frame_data.cc3
-rw-r--r--cc/output/gl_frame_data.h3
-rw-r--r--cc/output/gl_renderer.cc33
-rw-r--r--cc/output/gl_renderer.h3
-rw-r--r--cc/output/gl_renderer_unittest.cc49
-rw-r--r--cc/output/output_surface.cc69
-rw-r--r--cc/output/output_surface.h23
-rw-r--r--cc/output/output_surface_client.h4
-rw-r--r--cc/output/output_surface_unittest.cc4
-rw-r--r--cc/output/renderer.h5
-rw-r--r--cc/output/software_renderer.cc32
-rw-r--r--cc/output/software_renderer.h8
-rw-r--r--cc/scheduler/frame_rate_controller.cc20
-rw-r--r--cc/scheduler/frame_rate_controller.h3
-rw-r--r--cc/scheduler/scheduler.cc18
-rw-r--r--cc/scheduler/scheduler.h2
-rw-r--r--cc/test/fake_output_surface.cc54
-rw-r--r--cc/test/fake_output_surface.h14
-rw-r--r--cc/test/layer_tree_test.cc4
-rw-r--r--cc/trees/layer_tree_host.cc1
-rw-r--r--cc/trees/layer_tree_host.h1
-rw-r--r--cc/trees/layer_tree_host_impl.cc23
-rw-r--r--cc/trees/layer_tree_host_impl.h6
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc8
-rw-r--r--cc/trees/layer_tree_settings.cc3
-rw-r--r--cc/trees/layer_tree_settings.h1
-rw-r--r--cc/trees/thread_proxy.cc7
29 files changed, 171 insertions, 243 deletions
diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc
index ba2c4ec..3cb6b4f 100644
--- a/cc/output/delegating_renderer.cc
+++ b/cc/output/delegating_renderer.cc
@@ -53,8 +53,6 @@ bool DelegatingRenderer::Initialize() {
capabilities_.using_partial_swap = false;
// TODO(danakj): Throttling - we may want to only allow 1 outstanding frame,
// but the parent compositor may pipeline for us.
- // TODO(danakj): Can we use this in single-thread mode?
- capabilities_.using_swap_complete_callback = true;
capabilities_.max_texture_size = resource_provider_->max_texture_size();
capabilities_.best_texture_format = resource_provider_->best_texture_format();
capabilities_.allow_partial_texture_updates = false;
@@ -156,10 +154,10 @@ void DelegatingRenderer::DrawFrame(
resource_provider_->PrepareSendToParent(resources, &out_data.resource_list);
}
-void DelegatingRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) {
+void DelegatingRenderer::SwapBuffers() {
TRACE_EVENT0("cc", "DelegatingRenderer::SwapBuffers");
- output_surface_->SendFrameToParentCompositor(&frame_for_swap_buffers_);
+ output_surface_->SwapBuffers(&frame_for_swap_buffers_);
frame_for_swap_buffers_.delegated_frame_data.reset();
}
@@ -167,7 +165,7 @@ void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) {
NOTREACHED();
}
-void DelegatingRenderer::ReceiveCompositorFrameAck(
+void DelegatingRenderer::ReceiveSwapBuffersAck(
const CompositorFrameAck& ack) {
resource_provider_->ReceiveFromParent(ack.resources);
}
diff --git a/cc/output/delegating_renderer.h b/cc/output/delegating_renderer.h
index 20aa3f6..eb7e68f 100644
--- a/cc/output/delegating_renderer.h
+++ b/cc/output/delegating_renderer.h
@@ -32,12 +32,11 @@ class CC_EXPORT DelegatingRenderer : public Renderer {
virtual void Finish() OVERRIDE {}
- virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE;
+ virtual void SwapBuffers() OVERRIDE;
+ virtual void ReceiveSwapBuffersAck(const CompositorFrameAck&) OVERRIDE;
virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE;
- virtual void ReceiveCompositorFrameAck(const CompositorFrameAck&) OVERRIDE;
-
virtual bool IsContextLost() OVERRIDE;
virtual void SetVisible(bool visible) OVERRIDE;
diff --git a/cc/output/gl_frame_data.cc b/cc/output/gl_frame_data.cc
index b5b5721..06cf3f4 100644
--- a/cc/output/gl_frame_data.cc
+++ b/cc/output/gl_frame_data.cc
@@ -7,7 +7,8 @@
namespace cc {
GLFrameData::GLFrameData()
- : sync_point(0) {
+ : sync_point(0),
+ partial_swap_allowed(false) {
}
GLFrameData::~GLFrameData() {}
diff --git a/cc/output/gl_frame_data.h b/cc/output/gl_frame_data.h
index e6d227f..b8ec5ec 100644
--- a/cc/output/gl_frame_data.h
+++ b/cc/output/gl_frame_data.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "cc/base/cc_export.h"
#include "gpu/command_buffer/common/mailbox.h"
+#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
namespace cc {
@@ -22,6 +23,8 @@ class CC_EXPORT GLFrameData {
gpu::Mailbox mailbox;
uint32 sync_point;
gfx::Size size;
+ gfx::Rect sub_buffer_rect;
+ bool partial_swap_allowed;
};
} // namespace cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 6470ef20..1a19d28 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -157,11 +157,6 @@ bool GLRenderer::Initialize() {
Settings().partial_swap_enabled &&
extensions.count("GL_CHROMIUM_post_sub_buffer");
- // Use the SwapBuffers callback only with the threaded proxy.
- if (client_->HasImplThread())
- capabilities_.using_swap_complete_callback =
- extensions.count("GL_CHROMIUM_swapbuffers_complete_callback") > 0;
-
capabilities_.using_set_visibility =
extensions.count("GL_CHROMIUM_set_visibility") > 0;
@@ -1859,12 +1854,6 @@ void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) {
GLC(context_, context_->disable(GL_BLEND));
blend_shadow_ = false;
-
- if (Settings().compositor_frame_message) {
- CompositorFrame compositor_frame;
- compositor_frame.metadata = client_->MakeCompositorFrameMetadata();
- output_surface_->SendFrameToParentCompositor(&compositor_frame);
- }
}
void GLRenderer::FinishDrawingQuadList() { FlushTextureQuadCache(); }
@@ -1984,13 +1973,17 @@ void GLRenderer::Finish() {
context_->finish();
}
-void GLRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) {
+void GLRenderer::SwapBuffers() {
DCHECK(visible_);
DCHECK(!is_backbuffer_discarded_);
TRACE_EVENT0("cc", "GLRenderer::SwapBuffers");
// We're done! Time to swapbuffers!
+ CompositorFrame compositor_frame;
+ compositor_frame.metadata = client_->MakeCompositorFrameMetadata();
+ compositor_frame.gl_frame_data = make_scoped_ptr(new GLFrameData);
+ compositor_frame.gl_frame_data->size = output_surface_->SurfaceSize();
if (capabilities_.using_partial_swap && client_->AllowPartialSwap()) {
// If supported, we can save significant bandwidth by only swapping the
// damaged/scissored region (clamped to the viewport)
@@ -1998,14 +1991,18 @@ void GLRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) {
int flipped_y_pos_of_rect_bottom =
client_->DeviceViewport().height() - swap_buffer_rect_.y() -
swap_buffer_rect_.height();
- output_surface_->PostSubBuffer(gfx::Rect(swap_buffer_rect_.x(),
- flipped_y_pos_of_rect_bottom,
- swap_buffer_rect_.width(),
- swap_buffer_rect_.height()),
- latency_info);
+ compositor_frame.gl_frame_data->sub_buffer_rect =
+ gfx::Rect(swap_buffer_rect_.x(),
+ flipped_y_pos_of_rect_bottom,
+ swap_buffer_rect_.width(),
+ swap_buffer_rect_.height());
+ compositor_frame.gl_frame_data->partial_swap_allowed = true;
} else {
- output_surface_->SwapBuffers(latency_info);
+ compositor_frame.gl_frame_data->sub_buffer_rect =
+ gfx::Rect(output_surface_->SurfaceSize());
+ compositor_frame.gl_frame_data->partial_swap_allowed = false;
}
+ output_surface_->SwapBuffers(&compositor_frame);
swap_buffer_rect_ = gfx::Rect();
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index e693777..12eb8f7 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -60,8 +60,7 @@ class CC_EXPORT GLRenderer
virtual void Finish() OVERRIDE;
virtual void DoNoOp() OVERRIDE;
- // Puts backbuffer onscreen.
- virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE;
+ virtual void SwapBuffers() OVERRIDE;
virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE;
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index c1c8842..73ba45c 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -264,7 +264,7 @@ class GLRendererTest : public testing::Test {
virtual void SetUp() { renderer_.Initialize(); }
- void SwapBuffers() { renderer_.SwapBuffers(ui::LatencyInfo()); }
+ void SwapBuffers() { renderer_.SwapBuffers(); }
FrameCountingMemoryAllocationSettingContext* Context() {
return static_cast<FrameCountingMemoryAllocationSettingContext*>(
@@ -1552,13 +1552,11 @@ class MockOutputSurface : public OutputSurface {
}
virtual ~MockOutputSurface() {}
- MOCK_METHOD1(SendFrameToParentCompositor, void(CompositorFrame* frame));
MOCK_METHOD0(EnsureBackbuffer, void());
MOCK_METHOD0(DiscardBackbuffer, void());
MOCK_METHOD2(Reshape, void(gfx::Size size, float scale_factor));
MOCK_METHOD0(BindFramebuffer, void());
- MOCK_METHOD2(PostSubBuffer, void(gfx::Rect rect, const ui::LatencyInfo&));
- MOCK_METHOD1(SwapBuffers, void(const ui::LatencyInfo&));
+ MOCK_METHOD1(SwapBuffers, void(CompositorFrame* frame));
};
class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient {
@@ -1569,7 +1567,7 @@ class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient {
virtual void SetUp() { EXPECT_TRUE(renderer_.Initialize()); }
- void SwapBuffers() { renderer_.SwapBuffers(ui::LatencyInfo()); }
+ void SwapBuffers() { renderer_.SwapBuffers(); }
void DrawFrame() {
gfx::Rect viewport_rect(DeviceViewport());
@@ -1608,62 +1606,31 @@ TEST_F(MockOutputSurfaceTest, DrawFrameAndSwap) {
DrawFrame();
EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1);
- renderer_.SwapBuffers(ui::LatencyInfo());
+ renderer_.SwapBuffers();
}
TEST_F(MockOutputSurfaceTest, DrawFrameAndResizeAndSwap) {
DrawFrame();
EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1);
- renderer_.SwapBuffers(ui::LatencyInfo());
+ renderer_.SwapBuffers();
set_viewport_and_scale(gfx::Size(2, 2), 2.f);
renderer_.ViewportChanged();
DrawFrame();
EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1);
- renderer_.SwapBuffers(ui::LatencyInfo());
+ renderer_.SwapBuffers();
DrawFrame();
EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1);
- renderer_.SwapBuffers(ui::LatencyInfo());
+ renderer_.SwapBuffers();
set_viewport_and_scale(gfx::Size(1, 1), 1.f);
renderer_.ViewportChanged();
DrawFrame();
EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1);
- renderer_.SwapBuffers(ui::LatencyInfo());
-}
-
-class MockOutputSurfaceTestWithPartialSwap : public MockOutputSurfaceTest {
- public:
- virtual const LayerTreeSettings& Settings() const OVERRIDE {
- static LayerTreeSettings fake_settings;
- fake_settings.partial_swap_enabled = true;
- return fake_settings;
- }
-};
-
-TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) {
- DrawFrame();
-
- EXPECT_CALL(output_surface_, PostSubBuffer(_, _)).Times(1);
- renderer_.SwapBuffers(ui::LatencyInfo());
-}
-
-class MockOutputSurfaceTestWithSendCompositorFrame
- : public MockOutputSurfaceTest {
- public:
- virtual const LayerTreeSettings& Settings() const OVERRIDE {
- static LayerTreeSettings fake_settings;
- fake_settings.compositor_frame_message = true;
- return fake_settings;
- }
-};
-
-TEST_F(MockOutputSurfaceTestWithSendCompositorFrame, DrawFrame) {
- EXPECT_CALL(output_surface_, SendFrameToParentCompositor(_)).Times(1);
- DrawFrame();
+ renderer_.SwapBuffers();
}
class GLRendererTestSyncPoint : public GLRendererPixelTest {
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 3442f0d..0889b96 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -8,9 +8,12 @@
#include <string>
#include <vector>
+#include "base/bind.h"
#include "base/logging.h"
+#include "base/message_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
+#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface_client.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
@@ -35,7 +38,7 @@ class OutputSurfaceCallbacks
}
// WK:WGC3D::WGSwapBuffersCompleteCallbackCHROMIUM implementation.
- virtual void onSwapBuffersComplete() { client_->OnSwapBuffersComplete(); }
+ virtual void onSwapBuffersComplete() { client_->OnSwapBuffersComplete(NULL); }
// WK:WGC3D::WGContextLostCallback implementation.
virtual void onContextLost() { client_->DidLoseOutputSurface(); }
@@ -49,7 +52,9 @@ OutputSurface::OutputSurface(
: client_(NULL),
context3d_(context3d.Pass()),
has_gl_discard_backbuffer_(false),
- device_scale_factor_(-1) {
+ has_swap_buffers_complete_callback_(false),
+ device_scale_factor_(-1),
+ weak_ptr_factory_(this) {
}
OutputSurface::OutputSurface(
@@ -57,7 +62,9 @@ OutputSurface::OutputSurface(
: client_(NULL),
software_device_(software_device.Pass()),
has_gl_discard_backbuffer_(false),
- device_scale_factor_(-1) {
+ has_swap_buffers_complete_callback_(false),
+ device_scale_factor_(-1),
+ weak_ptr_factory_(this) {
}
OutputSurface::OutputSurface(
@@ -67,7 +74,9 @@ OutputSurface::OutputSurface(
context3d_(context3d.Pass()),
software_device_(software_device.Pass()),
has_gl_discard_backbuffer_(false),
- device_scale_factor_(-1) {
+ has_swap_buffers_complete_callback_(false),
+ device_scale_factor_(-1),
+ weak_ptr_factory_(this) {
}
OutputSurface::~OutputSurface() {
@@ -129,6 +138,9 @@ void OutputSurface::SetContext3D(
set<string> extensions(extensions_list.begin(), extensions_list.end());
has_gl_discard_backbuffer_ =
extensions.count("GL_CHROMIUM_discard_backbuffer") > 0;
+ has_swap_buffers_complete_callback_ =
+ extensions.count("GL_CHROMIUM_swapbuffers_complete_callback") > 0;
+
context3d_ = context3d.Pass();
callbacks_.reset(new OutputSurfaceCallbacks(client_));
@@ -136,10 +148,6 @@ void OutputSurface::SetContext3D(
context3d_->setContextLostCallback(callbacks_.get());
}
-void OutputSurface::SendFrameToParentCompositor(CompositorFrame* frame) {
- NOTIMPLEMENTED();
-}
-
void OutputSurface::EnsureBackbuffer() {
DCHECK(context3d_);
if (has_gl_discard_backbuffer_)
@@ -162,6 +170,8 @@ void OutputSurface::Reshape(gfx::Size size, float scale_factor) {
context3d_->reshapeWithScaleFactor(
size.width(), size.height(), scale_factor);
}
+ if (software_device_)
+ software_device_->Resize(size);
}
gfx::Size OutputSurface::SurfaceSize() const {
@@ -173,18 +183,43 @@ void OutputSurface::BindFramebuffer() {
context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0);
}
-void OutputSurface::SwapBuffers(const ui::LatencyInfo& latency_info) {
+void OutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
+ if (frame->software_frame_data) {
+ PostSwapBuffersComplete();
+ return;
+ }
+
DCHECK(context3d_);
- // Note that currently this has the same effect as SwapBuffers; we should
- // consider exposing a different entry point on WebGraphicsContext3D.
- context3d_->prepareTexture();
+ DCHECK(frame->gl_frame_data);
+
+ if (frame->gl_frame_data->partial_swap_allowed) {
+ gfx::Rect sub_buffer_rect = frame->gl_frame_data->sub_buffer_rect;
+ context3d()->postSubBufferCHROMIUM(sub_buffer_rect.x(),
+ sub_buffer_rect.y(),
+ sub_buffer_rect.width(),
+ sub_buffer_rect.height());
+ } else {
+ // Note that currently this has the same effect as SwapBuffers; we should
+ // consider exposing a different entry point on WebGraphicsContext3D.
+ context3d()->prepareTexture();
+ }
+
+ if (!has_swap_buffers_complete_callback_)
+ PostSwapBuffersComplete();
}
-void OutputSurface::PostSubBuffer(gfx::Rect rect,
- const ui::LatencyInfo& latency_info) {
- DCHECK(context3d_);
- context3d_->postSubBufferCHROMIUM(
- rect.x(), rect.y(), rect.width(), rect.height());
+void OutputSurface::PostSwapBuffersComplete() {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&OutputSurface::SwapBuffersComplete,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void OutputSurface::SwapBuffersComplete() {
+ if (!client_)
+ return;
+
+ client_->OnSwapBuffersComplete(NULL);
}
} // namespace cc
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h
index fb93eb7..d263d3a 100644
--- a/cc/output/output_surface.h
+++ b/cc/output/output_surface.h
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/output/context_provider.h"
#include "cc/output/software_output_device.h"
@@ -46,11 +47,11 @@ class CC_EXPORT OutputSurface {
struct Capabilities {
Capabilities()
- : has_parent_compositor(false),
+ : delegated_rendering(false),
max_frames_pending(0),
deferred_gl_initialization(false) {}
- bool has_parent_compositor;
+ bool delegated_rendering;
int max_frames_pending;
bool deferred_gl_initialization;
};
@@ -82,11 +83,6 @@ class CC_EXPORT OutputSurface {
// thread.
virtual bool BindToClient(OutputSurfaceClient* client);
- // Sends frame data to the parent compositor. This should only be called when
- // capabilities().has_parent_compositor. The implementation may destroy or
- // steal the contents of the CompositorFrame passed in.
- virtual void SendFrameToParentCompositor(CompositorFrame* frame);
-
virtual void EnsureBackbuffer();
virtual void DiscardBackbuffer();
@@ -95,8 +91,10 @@ class CC_EXPORT OutputSurface {
virtual void BindFramebuffer();
- virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&);
- virtual void SwapBuffers(const ui::LatencyInfo&);
+ // The implementation may destroy or steal the contents of the CompositorFrame
+ // passed in (though it will not take ownership of the CompositorFrame
+ // itself).
+ virtual void SwapBuffers(CompositorFrame* frame);
// Notifies frame-rate smoothness preference. If true, all non-critical
// processing should be stopped, or lowered in priority.
@@ -116,17 +114,24 @@ class CC_EXPORT OutputSurface {
scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
scoped_refptr<ContextProvider> offscreen_context_provider);
+ void PostSwapBuffersComplete();
+
OutputSurfaceClient* client_;
struct cc::OutputSurface::Capabilities capabilities_;
scoped_ptr<OutputSurfaceCallbacks> callbacks_;
scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
scoped_ptr<cc::SoftwareOutputDevice> software_device_;
bool has_gl_discard_backbuffer_;
+ bool has_swap_buffers_complete_callback_;
gfx::Size surface_size_;
float device_scale_factor_;
private:
void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
+ void SwapBuffersComplete();
+
+ base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(OutputSurface);
};
diff --git a/cc/output/output_surface_client.h b/cc/output/output_surface_client.h
index dc68e96..f5999c3 100644
--- a/cc/output/output_surface_client.h
+++ b/cc/output/output_surface_client.h
@@ -30,9 +30,7 @@ class CC_EXPORT OutputSurfaceClient {
virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
base::TimeDelta interval) = 0;
virtual void BeginFrame(base::TimeTicks frame_time) = 0;
- virtual void OnSendFrameToParentCompositorAck(
- const CompositorFrameAck& ack) = 0;
- virtual void OnSwapBuffersComplete() = 0;
+ virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) = 0;
virtual void DidLoseOutputSurface() = 0;
virtual void SetExternalDrawConstraints(const gfx::Transform& transform,
gfx::Rect viewport) = 0;
diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc
index 72bf0a4..ebc018f 100644
--- a/cc/output/output_surface_unittest.cc
+++ b/cc/output/output_surface_unittest.cc
@@ -50,9 +50,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient {
virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
base::TimeDelta interval) OVERRIDE {}
virtual void BeginFrame(base::TimeTicks frame_time) OVERRIDE {}
- virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
- OVERRIDE {}
- virtual void OnSwapBuffersComplete() OVERRIDE {}
+ virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE {}
virtual void DidLoseOutputSurface() OVERRIDE {
did_lose_output_surface_called_ = true;
}
diff --git a/cc/output/renderer.h b/cc/output/renderer.h
index a905d4c..efb1dfc 100644
--- a/cc/output/renderer.h
+++ b/cc/output/renderer.h
@@ -10,7 +10,6 @@
#include "cc/quads/render_pass.h"
#include "cc/resources/managed_memory_policy.h"
#include "cc/trees/layer_tree_host.h"
-#include "ui/base/latency_info.h"
namespace cc {
@@ -49,7 +48,6 @@ class CC_EXPORT Renderer {
const LayerTreeSettings& Settings() const { return client_->Settings(); }
virtual void ViewportChanged() {}
- virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {}
virtual bool CanReadPixels() const = 0;
@@ -67,7 +65,8 @@ class CC_EXPORT Renderer {
virtual void DoNoOp() {}
// Puts backbuffer onscreen.
- virtual void SwapBuffers(const ui::LatencyInfo& latency_info) = 0;
+ virtual void SwapBuffers() = 0;
+ virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {}
virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) = 0;
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index d6c598a..87bc129 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -56,7 +56,6 @@ SoftwareRenderer::SoftwareRenderer(RendererClient* client,
: DirectRenderer(client, output_surface, resource_provider),
visible_(true),
is_scissor_enabled_(false),
- is_viewport_changed_(true),
output_device_(output_surface->software_device()),
current_canvas_(NULL) {
if (resource_provider_) {
@@ -68,9 +67,6 @@ SoftwareRenderer::SoftwareRenderer(RendererClient* client,
// The updater can access bitmaps while the SoftwareRenderer is using them.
capabilities_.allow_partial_texture_updates = true;
capabilities_.using_partial_swap = true;
- if (Settings().compositor_frame_message && client_->HasImplThread())
- capabilities_.using_swap_complete_callback = true;
- compositor_frame_.software_frame_data.reset(new SoftwareFrameData());
}
SoftwareRenderer::~SoftwareRenderer() {}
@@ -79,16 +75,8 @@ const RendererCapabilities& SoftwareRenderer::Capabilities() const {
return capabilities_;
}
-void SoftwareRenderer::ViewportChanged() {
- is_viewport_changed_ = true;
-}
-
void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) {
TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame");
- if (is_viewport_changed_) {
- is_viewport_changed_ = false;
- output_device_->Resize(client_->DeviceViewport().size());
- }
root_canvas_ = output_device_->BeginPaint(
gfx::ToEnclosingRect(frame->root_damage_rect));
}
@@ -98,21 +86,19 @@ void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) {
current_framebuffer_lock_.reset();
current_canvas_ = NULL;
root_canvas_ = NULL;
- if (Settings().compositor_frame_message) {
- compositor_frame_.metadata = client_->MakeCompositorFrameMetadata();
- output_device_->EndPaint(compositor_frame_.software_frame_data.get());
- } else {
- output_device_->EndPaint(NULL);
- }
+
+ current_frame_data_.reset(new SoftwareFrameData);
+ output_device_->EndPaint(current_frame_data_.get());
}
-void SoftwareRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) {
- if (Settings().compositor_frame_message)
- output_surface_->SendFrameToParentCompositor(&compositor_frame_);
+void SoftwareRenderer::SwapBuffers() {
+ CompositorFrame compositor_frame;
+ compositor_frame.metadata = client_->MakeCompositorFrameMetadata();
+ compositor_frame.software_frame_data = current_frame_data_.Pass();
+ output_surface_->SwapBuffers(&compositor_frame);
}
-void SoftwareRenderer::ReceiveCompositorFrameAck(
- const CompositorFrameAck& ack) {
+void SoftwareRenderer::ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {
output_device_->ReclaimSoftwareFrame(ack.last_software_frame_id);
}
diff --git a/cc/output/software_renderer.h b/cc/output/software_renderer.h
index 8eb9c0e..079ee1e 100644
--- a/cc/output/software_renderer.h
+++ b/cc/output/software_renderer.h
@@ -33,16 +33,15 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer {
virtual ~SoftwareRenderer();
virtual const RendererCapabilities& Capabilities() const OVERRIDE;
- virtual void ViewportChanged() OVERRIDE;
virtual void Finish() OVERRIDE;
- virtual void SwapBuffers(const ui::LatencyInfo& latency_info) OVERRIDE;
+ virtual void SwapBuffers() OVERRIDE;
virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE;
virtual void SetVisible(bool visible) OVERRIDE;
virtual void SendManagedMemoryStats(
size_t bytes_visible,
size_t bytes_visible_and_nearby,
size_t bytes_allocated) OVERRIDE {}
- virtual void ReceiveCompositorFrameAck(
+ virtual void ReceiveSwapBuffersAck(
const CompositorFrameAck& ack) OVERRIDE;
protected:
@@ -92,7 +91,6 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer {
RendererCapabilities capabilities_;
bool visible_;
bool is_scissor_enabled_;
- bool is_viewport_changed_;
gfx::Rect scissor_rect_;
SoftwareOutputDevice* output_device_;
@@ -101,7 +99,7 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer {
SkPaint current_paint_;
scoped_ptr<ResourceProvider::ScopedWriteLockSoftware>
current_framebuffer_lock_;
- CompositorFrame compositor_frame_;
+ scoped_ptr<SoftwareFrameData> current_frame_data_;
DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer);
};
diff --git a/cc/scheduler/frame_rate_controller.cc b/cc/scheduler/frame_rate_controller.cc
index bcb12d2..b4f1272 100644
--- a/cc/scheduler/frame_rate_controller.cc
+++ b/cc/scheduler/frame_rate_controller.cc
@@ -37,7 +37,6 @@ FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer)
max_frames_pending_(0),
time_source_(timer),
active_(false),
- swap_buffers_complete_supported_(true),
is_time_source_throttling_(true),
weak_factory_(this),
thread_(NULL) {
@@ -51,7 +50,6 @@ FrameRateController::FrameRateController(Thread* thread)
num_frames_pending_(0),
max_frames_pending_(0),
active_(false),
- swap_buffers_complete_supported_(true),
is_time_source_throttling_(false),
weak_factory_(this),
thread_(thread) {}
@@ -88,14 +86,6 @@ void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase,
time_source_->SetTimebaseAndInterval(timebase, interval);
}
-bool FrameRateController::swap_buffers_complete_supported() const {
- return swap_buffers_complete_supported_;
-}
-
-void FrameRateController::SetSwapBuffersCompleteSupported(bool supported) {
- swap_buffers_complete_supported_ = supported;
-}
-
void FrameRateController::OnTimerTick() {
DCHECK(active_);
@@ -107,8 +97,7 @@ void FrameRateController::OnTimerTick() {
if (client_)
client_->BeginFrame(throttled);
- if (swap_buffers_complete_supported_ && !is_time_source_throttling_ &&
- !throttled)
+ if (!is_time_source_throttling_ && !throttled)
PostManualTick();
}
@@ -122,15 +111,10 @@ void FrameRateController::PostManualTick() {
void FrameRateController::ManualTick() { OnTimerTick(); }
void FrameRateController::DidSwapBuffers() {
- if (swap_buffers_complete_supported_)
- num_frames_pending_++;
- else if (!is_time_source_throttling_)
- PostManualTick();
+ num_frames_pending_++;
}
void FrameRateController::DidSwapBuffersComplete() {
- DCHECK(swap_buffers_complete_supported_);
-
DCHECK_GT(num_frames_pending_, 0);
num_frames_pending_--;
if (!is_time_source_throttling_)
diff --git a/cc/scheduler/frame_rate_controller.h b/cc/scheduler/frame_rate_controller.h
index 339578a..070c26a 100644
--- a/cc/scheduler/frame_rate_controller.h
+++ b/cc/scheduler/frame_rate_controller.h
@@ -63,8 +63,6 @@ class CC_EXPORT FrameRateController {
void SetTimebaseAndInterval(base::TimeTicks timebase,
base::TimeDelta interval);
- bool swap_buffers_complete_supported() const;
- void SetSwapBuffersCompleteSupported(bool supported);
protected:
friend class FrameRateControllerTimeSourceAdapter;
@@ -79,7 +77,6 @@ class CC_EXPORT FrameRateController {
scoped_refptr<TimeSource> time_source_;
scoped_ptr<FrameRateControllerTimeSourceAdapter> time_source_client_adapter_;
bool active_;
- bool swap_buffers_complete_supported_;
// Members for unthrottled frame-rate.
bool is_time_source_throttling_;
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index e34e6d5..d308b0d 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -100,14 +100,6 @@ int Scheduler::NumFramesPendingForTesting() const {
return frame_rate_controller_->NumFramesPendingForTesting();
}
-bool Scheduler::swap_buffers_complete_supported() const {
- return frame_rate_controller_->swap_buffers_complete_supported();
-}
-
-void Scheduler::SetSwapBuffersCompleteSupported(bool supported) {
- frame_rate_controller_->SetSwapBuffersCompleteSupported(supported);
-}
-
void Scheduler::DidSwapBuffersComplete() {
TRACE_EVENT0("cc", "Scheduler::DidSwapBuffersComplete");
frame_rate_controller_->DidSwapBuffersComplete();
@@ -178,18 +170,20 @@ void Scheduler::ProcessScheduledActions() {
client_->ScheduledActionActivatePendingTreeIfNeeded();
break;
case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: {
+ frame_rate_controller_->DidSwapBuffers();
ScheduledActionDrawAndSwapResult result =
client_->ScheduledActionDrawAndSwapIfPossible();
state_machine_.DidDrawIfPossibleCompleted(result.did_draw);
- if (result.did_swap)
- frame_rate_controller_->DidSwapBuffers();
+ if (!result.did_swap)
+ frame_rate_controller_->DidSwapBuffersComplete();
break;
}
case SchedulerStateMachine::ACTION_DRAW_FORCED: {
+ frame_rate_controller_->DidSwapBuffers();
ScheduledActionDrawAndSwapResult result =
client_->ScheduledActionDrawAndSwapForced();
- if (result.did_swap)
- frame_rate_controller_->DidSwapBuffers();
+ if (!result.did_swap)
+ frame_rate_controller_->DidSwapBuffersComplete();
break;
}
case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 5bdb186..6ecd889 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -90,8 +90,6 @@ class CC_EXPORT Scheduler : FrameRateControllerClient {
int MaxFramesPending() const;
int NumFramesPendingForTesting() const;
- bool swap_buffers_complete_supported() const;
- void SetSwapBuffersCompleteSupported(bool supported);
void DidSwapBuffersComplete();
void DidLoseOutputSurface();
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc
index d393ba0..c3f3e1a 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -12,44 +12,55 @@
namespace cc {
FakeOutputSurface::FakeOutputSurface(
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent)
+ scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
+ bool delegated_rendering)
: OutputSurface(context3d.Pass()),
num_sent_frames_(0),
needs_begin_frame_(false),
- forced_draw_to_software_device_(false),
- weak_ptr_factory_(this) {
- capabilities_.has_parent_compositor = has_parent;
+ forced_draw_to_software_device_(false) {
+ if (delegated_rendering) {
+ capabilities_.delegated_rendering = true;
+ capabilities_.max_frames_pending = 1;
+ }
}
FakeOutputSurface::FakeOutputSurface(
- scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent)
+ scoped_ptr<SoftwareOutputDevice> software_device, bool delegated_rendering)
: OutputSurface(software_device.Pass()),
num_sent_frames_(0),
- forced_draw_to_software_device_(false),
- weak_ptr_factory_(this) {
- capabilities_.has_parent_compositor = has_parent;
+ forced_draw_to_software_device_(false) {
+ if (delegated_rendering) {
+ capabilities_.delegated_rendering = true;
+ capabilities_.max_frames_pending = 1;
+ }
}
FakeOutputSurface::FakeOutputSurface(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
scoped_ptr<SoftwareOutputDevice> software_device,
- bool has_parent)
+ bool delegated_rendering)
: OutputSurface(context3d.Pass(), software_device.Pass()),
num_sent_frames_(0),
- forced_draw_to_software_device_(false),
- weak_ptr_factory_(this) {
- capabilities_.has_parent_compositor = has_parent;
+ forced_draw_to_software_device_(false) {
+ if (delegated_rendering) {
+ capabilities_.delegated_rendering = true;
+ capabilities_.max_frames_pending = 1;
+ }
}
FakeOutputSurface::~FakeOutputSurface() {}
-void FakeOutputSurface::SendFrameToParentCompositor(
- CompositorFrame* frame) {
- frame->AssignTo(&last_sent_frame_);
- ++num_sent_frames_;
- base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck,
- weak_ptr_factory_.GetWeakPtr()));
+void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) {
+ if (frame->software_frame_data || frame->delegated_frame_data ||
+ !context3d()) {
+ frame->AssignTo(&last_sent_frame_);
+ ++num_sent_frames_;
+ PostSwapBuffersComplete();
+ } else {
+ OutputSurface::SwapBuffers(frame);
+ frame->AssignTo(&last_sent_frame_);
+ ++num_sent_frames_;
+ }
}
void FakeOutputSurface::SetNeedsBeginFrame(bool enable) {
@@ -64,9 +75,4 @@ bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const {
return forced_draw_to_software_device_;
}
-void FakeOutputSurface::SendFrameAck() {
- CompositorFrameAck ack;
- client_->OnSendFrameToParentCompositorAck(ack);
-}
-
} // namespace cc
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h
index 7460f93..d54ffd3 100644
--- a/cc/test/fake_output_surface.h
+++ b/cc/test/fake_output_surface.h
@@ -5,7 +5,6 @@
#ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_
#define CC_TEST_FAKE_OUTPUT_SURFACE_H_
-#include "base/memory/weak_ptr.h"
#include "base/time.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface.h"
@@ -66,11 +65,11 @@ class FakeOutputSurface : public OutputSurface {
return result.Pass();
}
- virtual void SendFrameToParentCompositor(CompositorFrame* frame) OVERRIDE;
-
CompositorFrame& last_sent_frame() { return last_sent_frame_; }
size_t num_sent_frames() { return num_sent_frames_; }
+ virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE;
+
virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
bool needs_begin_frame() const {
return needs_begin_frame_;
@@ -85,24 +84,21 @@ class FakeOutputSurface : public OutputSurface {
protected:
FakeOutputSurface(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
- bool has_parent);
+ bool delegated_rendering);
FakeOutputSurface(
scoped_ptr<SoftwareOutputDevice> software_device,
- bool has_parent);
+ bool delegated_rendering);
FakeOutputSurface(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
scoped_ptr<SoftwareOutputDevice> software_device,
- bool has_parent);
-
- void SendFrameAck();
+ bool delegated_rendering);
CompositorFrame last_sent_frame_;
size_t num_sent_frames_;
bool needs_begin_frame_;
bool forced_draw_to_software_device_;
- base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_;
};
static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() {
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 4ae5248..477a4ee 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -104,8 +104,8 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
return result;
}
- virtual void OnSwapBuffersComplete() OVERRIDE {
- LayerTreeHostImpl::OnSwapBuffersComplete();
+ virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE {
+ LayerTreeHostImpl::OnSwapBuffersComplete(ack);
test_hooks_->SwapBuffersCompleteOnThread(this);
}
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 999a7c6..5e19eb3 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -48,7 +48,6 @@ RendererCapabilities::RendererCapabilities()
: best_texture_format(0),
using_partial_swap(false),
using_set_visibility(false),
- using_swap_complete_callback(false),
using_gpu_memory_manager(false),
using_egl_image(false),
allow_partial_texture_updates(false),
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 35a97c7..28beb1f 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -74,7 +74,6 @@ struct CC_EXPORT RendererCapabilities {
unsigned best_texture_format;
bool using_partial_swap;
bool using_set_visibility;
- bool using_swap_complete_callback;
bool using_gpu_memory_manager;
bool using_egl_image;
bool allow_partial_texture_updates;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 492df4d..ec59dae 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -933,8 +933,6 @@ bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame,
if (!CalculateRenderPasses(frame))
return false;
- frame->latency_info = active_tree_->GetLatencyInfo();
-
// If we return true, then we expect DrawLayers() to be called before this
// function is called again.
return true;
@@ -1068,17 +1066,14 @@ void LayerTreeHostImpl::BeginFrame(base::TimeTicks frame_time) {
client_->BeginFrameOnImplThread(frame_time);
}
-void LayerTreeHostImpl::OnSendFrameToParentCompositorAck(
- const CompositorFrameAck& ack) {
- if (!renderer_)
- return;
-
+void LayerTreeHostImpl::OnSwapBuffersComplete(
+ const CompositorFrameAck* ack) {
// TODO(piman): We may need to do some validation on this ack before
// processing it.
- renderer_->ReceiveCompositorFrameAck(ack);
+ if (ack && renderer_)
+ renderer_->ReceiveSwapBuffersAck(*ack);
- // When using compositor frame data, the ack doubles as a swap complete ack.
- OnSwapBuffersComplete();
+ client_->OnSwapBuffersCompleteOnImplThread();
}
void LayerTreeHostImpl::OnCanDrawStateChangedForTree() {
@@ -1230,7 +1225,7 @@ const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const {
bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
if (frame.has_no_damage)
return false;
- renderer_->SwapBuffers(frame.latency_info);
+ renderer_->SwapBuffers();
active_tree_->ClearLatencyInfo();
return true;
}
@@ -1273,10 +1268,6 @@ void LayerTreeHostImpl::DidLoseOutputSurface() {
client_->DidLoseOutputSurfaceOnImplThread();
}
-void LayerTreeHostImpl::OnSwapBuffersComplete() {
- client_->OnSwapBuffersCompleteOnImplThread();
-}
-
void LayerTreeHostImpl::Readback(void* pixels,
gfx::Rect rect_in_device_viewport) {
DCHECK(renderer_);
@@ -1483,7 +1474,7 @@ bool LayerTreeHostImpl::DoInitializeRenderer(
if (!resource_provider)
return false;
- if (output_surface->capabilities().has_parent_compositor) {
+ if (output_surface->capabilities().delegated_rendering) {
renderer_ = DelegatingRenderer::Create(this, output_surface.get(),
resource_provider.get());
} else if (output_surface->context3d()) {
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 5bfbcfd..e05e45b 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -26,7 +26,6 @@
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkPicture.h"
-#include "ui/base/latency_info.h"
#include "ui/gfx/rect.h"
namespace cc {
@@ -146,7 +145,6 @@ class CC_EXPORT LayerTreeHostImpl
LayerImplList will_draw_layers;
bool contains_incomplete_tile;
bool has_no_damage;
- ui::LatencyInfo latency_info;
// RenderPassSink implementation.
virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE;
@@ -186,7 +184,7 @@ class CC_EXPORT LayerTreeHostImpl
virtual const LayerTreeSettings& Settings() const OVERRIDE;
public:
virtual void DidLoseOutputSurface() OVERRIDE;
- virtual void OnSwapBuffersComplete() OVERRIDE;
+ virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE;
virtual void SetFullRootLayerDamage() OVERRIDE;
virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
OVERRIDE;
@@ -210,8 +208,6 @@ class CC_EXPORT LayerTreeHostImpl
base::TimeDelta interval) OVERRIDE;
virtual void BeginFrame(base::TimeTicks frame_time)
OVERRIDE;
- virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
- OVERRIDE;
virtual void SetExternalDrawConstraints(const gfx::Transform& transform,
gfx::Rect viewport) OVERRIDE;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 2518fa3..097244c 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -74,12 +74,9 @@ class LayerTreeHostImplTest : public testing::Test,
media::InitializeMediaLibraryForTesting();
}
- virtual void OverrideSettings(LayerTreeSettings* settings) {}
-
virtual void SetUp() OVERRIDE {
LayerTreeSettings settings;
settings.minimum_occlusion_tracking_size = gfx::Size();
- OverrideSettings(&settings);
host_impl_ = LayerTreeHostImpl::Create(settings,
this,
@@ -5748,9 +5745,6 @@ class CompositorFrameMetadataTest : public LayerTreeHostImplTest {
CompositorFrameMetadataTest()
: swap_buffers_complete_(0) {}
- virtual void OverrideSettings(LayerTreeSettings* settings) OVERRIDE {
- settings->compositor_frame_message = true;
- }
virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {
swap_buffers_complete_++;
}
@@ -5767,7 +5761,7 @@ TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) {
host_impl_->DidDrawAllLayers(frame);
}
CompositorFrameAck ack;
- host_impl_->OnSendFrameToParentCompositorAck(ack);
+ host_impl_->OnSwapBuffersComplete(&ack);
EXPECT_EQ(swap_buffers_complete_, 1);
}
diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc
index 21e876f..b4cc8d0 100644
--- a/cc/trees/layer_tree_settings.cc
+++ b/cc/trees/layer_tree_settings.cc
@@ -13,8 +13,7 @@
namespace cc {
LayerTreeSettings::LayerTreeSettings()
- : compositor_frame_message(false),
- impl_side_painting(false),
+ : impl_side_painting(false),
throttle_frame_production(true),
begin_frame_scheduling_enabled(false),
using_synchronous_renderer_compositor(false),
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
index 2f33f77..7f8455f 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -20,7 +20,6 @@ class CC_EXPORT LayerTreeSettings {
LayerTreeSettings();
~LayerTreeSettings();
- bool compositor_frame_message;
bool impl_side_painting;
bool throttle_frame_production;
bool begin_frame_scheduling_enabled;
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 5f92c61..98512468 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -1157,8 +1157,6 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread(
if (*success) {
*capabilities = layer_tree_host_impl_->GetRendererCapabilities();
- scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported(
- capabilities->using_swap_complete_callback);
OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface();
DCHECK(output_surface_ptr);
@@ -1166,8 +1164,6 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread(
output_surface_ptr->capabilities().max_frames_pending;
if (max_frames_pending <= 0)
max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
- if (output_surface_ptr->capabilities().has_parent_compositor)
- max_frames_pending = 1;
scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending);
@@ -1189,9 +1185,6 @@ void ThreadProxy::DidTryInitializeRendererOnImplThread(
offscreen_context_provider->BindToCurrentThread();
if (success) {
- DCHECK_EQ(layer_tree_host_impl_->GetRendererCapabilities()
- .using_swap_complete_callback,
- scheduler_on_impl_thread_->swap_buffers_complete_supported());
if (layer_tree_host_impl_->resource_provider()) {
layer_tree_host_impl_->resource_provider()->
set_offscreen_context_provider(offscreen_context_provider);