summaryrefslogtreecommitdiffstats
path: root/cc/test
diff options
context:
space:
mode:
authorjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 05:17:18 +0000
committerjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 05:17:18 +0000
commit5f07afcd9dc529b87cfa860ba8cbb526af214dec (patch)
tree5ae9ed998300679338518998b64b8972ab951350 /cc/test
parentd12ffd8adf17f6442ed60900d14eaa84d0b4f027 (diff)
downloadchromium_src-5f07afcd9dc529b87cfa860ba8cbb526af214dec.zip
chromium_src-5f07afcd9dc529b87cfa860ba8cbb526af214dec.tar.gz
chromium_src-5f07afcd9dc529b87cfa860ba8cbb526af214dec.tar.bz2
Adds a new callback as this signal is required to pass up to the application
independent of whether the compositor is generating frames BUG=232944 Review URL: https://chromiumcodereview.appspot.com/16958012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r--cc/test/fake_output_surface.cc18
-rw-r--r--cc/test/fake_output_surface.h6
-rw-r--r--cc/test/fake_output_surface_client.h1
-rw-r--r--cc/test/layer_tree_test.h1
-rw-r--r--cc/test/pixel_test.cc1
5 files changed, 27 insertions, 0 deletions
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc
index 6694b06..09af44c 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -16,6 +16,7 @@ FakeOutputSurface::FakeOutputSurface(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
bool delegated_rendering)
: OutputSurface(context3d.Pass()),
+ client_(NULL),
num_sent_frames_(0),
needs_begin_frame_(false),
forced_draw_to_software_device_(false),
@@ -29,6 +30,7 @@ FakeOutputSurface::FakeOutputSurface(
FakeOutputSurface::FakeOutputSurface(
scoped_ptr<SoftwareOutputDevice> software_device, bool delegated_rendering)
: OutputSurface(software_device.Pass()),
+ client_(NULL),
num_sent_frames_(0),
forced_draw_to_software_device_(false),
fake_weak_ptr_factory_(this) {
@@ -43,6 +45,7 @@ FakeOutputSurface::FakeOutputSurface(
scoped_ptr<SoftwareOutputDevice> software_device,
bool delegated_rendering)
: OutputSurface(context3d.Pass(), software_device.Pass()),
+ client_(NULL),
num_sent_frames_(0),
forced_draw_to_software_device_(false),
fake_weak_ptr_factory_(this) {
@@ -91,6 +94,15 @@ bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const {
return forced_draw_to_software_device_;
}
+bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) {
+ if (OutputSurface::BindToClient(client)) {
+ client_ = client;
+ return true;
+ } else {
+ return false;
+ }
+}
+
bool FakeOutputSurface::SetAndInitializeContext3D(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
context3d_.reset();
@@ -98,4 +110,10 @@ bool FakeOutputSurface::SetAndInitializeContext3D(
scoped_refptr<ContextProvider>());
}
+void FakeOutputSurface::SetTreeActivationCallback(
+ const base::Closure& callback) {
+ DCHECK(client_);
+ client_->SetTreeActivationCallback(callback);
+}
+
} // namespace cc
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h
index ad81d84..18759ec 100644
--- a/cc/test/fake_output_surface.h
+++ b/cc/test/fake_output_surface.h
@@ -5,6 +5,7 @@
#ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_
#define CC_TEST_FAKE_OUTPUT_SURFACE_H_
+#include "base/callback.h"
#include "base/time/time.h"
#include "cc/output/begin_frame_args.h"
#include "cc/output/compositor_frame.h"
@@ -78,11 +79,15 @@ class FakeOutputSurface : public OutputSurface {
}
virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
+ virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE;
+
bool SetAndInitializeContext3D(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
using OutputSurface::ReleaseGL;
+ void SetTreeActivationCallback(const base::Closure& callback);
+
protected:
FakeOutputSurface(
scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
@@ -99,6 +104,7 @@ class FakeOutputSurface : public OutputSurface {
void OnBeginFrame();
+ OutputSurfaceClient* client_;
CompositorFrame last_sent_frame_;
size_t num_sent_frames_;
bool needs_begin_frame_;
diff --git a/cc/test/fake_output_surface_client.h b/cc/test/fake_output_surface_client.h
index b948958..830dcad 100644
--- a/cc/test/fake_output_surface_client.h
+++ b/cc/test/fake_output_surface_client.h
@@ -32,6 +32,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient {
virtual void SetMemoryPolicy(
const ManagedMemoryPolicy& policy,
bool discard_backbuffer_when_not_visible) OVERRIDE;
+ virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {}
int begin_frame_count() {
return begin_frame_count_;
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index 4e4f951..556378b 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -151,6 +151,7 @@ class LayerTreeTest : public testing::Test, public TestHooks {
LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); }
bool delegating_renderer() const { return delegating_renderer_; }
+ FakeOutputSurface* output_surface() { return output_surface_; }
virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE;
virtual scoped_refptr<cc::ContextProvider>
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index ae4e102..23a1a4f 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -67,6 +67,7 @@ class PixelTest::PixelTestRendererClient
}
virtual void SetMemoryPolicy(
const ManagedMemoryPolicy& policy, bool discard) OVERRIDE {}
+ virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {}
private:
gfx::Rect device_viewport_;