summaryrefslogtreecommitdiffstats
path: root/cc/test
diff options
context:
space:
mode:
Diffstat (limited to 'cc/test')
-rw-r--r--cc/test/pixel_test.cc4
-rw-r--r--cc/test/test_web_graphics_context_3d.cc14
-rw-r--r--cc/test/test_web_graphics_context_3d.h7
3 files changed, 23 insertions, 2 deletions
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index cd007c1..ed1ad5a 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -41,8 +41,6 @@ class PixelTest::PixelTestRendererClient
return settings_;
}
virtual void SetFullRootLayerDamage() OVERRIDE {}
- virtual void SetManagedMemoryPolicy(
- const ManagedMemoryPolicy& policy) OVERRIDE {}
virtual bool HasImplThread() const OVERRIDE { return false; }
virtual bool ShouldClearRootRenderPass() const OVERRIDE { return true; }
virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const
@@ -66,6 +64,8 @@ class PixelTest::PixelTestRendererClient
gfx::Rect viewport) OVERRIDE {
device_viewport_ = viewport;
}
+ virtual void SetMemoryPolicy(
+ const ManagedMemoryPolicy& policy, bool discard) OVERRIDE {}
private:
gfx::Rect device_viewport_;
diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc
index 2f1f4c7..f5ebb6b 100644
--- a/cc/test/test_web_graphics_context_3d.cc
+++ b/cc/test/test_web_graphics_context_3d.cc
@@ -52,6 +52,7 @@ TestWebGraphicsContext3D::TestWebGraphicsContext3D()
times_map_buffer_chromium_succeeds_(-1),
context_lost_callback_(NULL),
swap_buffers_callback_(NULL),
+ memory_allocation_changed_callback_(NULL),
max_texture_size_(1024),
width_(0),
height_(0),
@@ -78,6 +79,7 @@ TestWebGraphicsContext3D::TestWebGraphicsContext3D(
times_map_buffer_chromium_succeeds_(-1),
context_lost_callback_(NULL),
swap_buffers_callback_(NULL),
+ memory_allocation_changed_callback_(NULL),
max_texture_size_(1024),
width_(0),
height_(0),
@@ -368,6 +370,11 @@ void TestWebGraphicsContext3D::setSwapBuffersCompleteCallbackCHROMIUM(
swap_buffers_callback_ = callback;
}
+void TestWebGraphicsContext3D::setMemoryAllocationChangedCallbackCHROMIUM(
+ WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) {
+ memory_allocation_changed_callback_ = callback;
+}
+
void TestWebGraphicsContext3D::prepareTexture() {
if (swap_buffers_callback_) {
base::MessageLoop::current()->PostTask(
@@ -531,6 +538,13 @@ WebKit::WGC3Duint TestWebGraphicsContext3D::NextImageId() {
return image_id;
}
+void TestWebGraphicsContext3D::SetMemoryAllocation(
+ WebKit::WebGraphicsMemoryAllocation allocation) {
+ if (!memory_allocation_changed_callback_)
+ return;
+ memory_allocation_changed_callback_->onMemoryAllocationChanged(allocation);
+}
+
TestWebGraphicsContext3D::Buffer::Buffer() : target(0) {}
TestWebGraphicsContext3D::Buffer::~Buffer() {}
diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h
index 401fa4a4..4855b0a 100644
--- a/cc/test/test_web_graphics_context_3d.h
+++ b/cc/test/test_web_graphics_context_3d.h
@@ -114,6 +114,9 @@ class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D {
virtual void setSwapBuffersCompleteCallbackCHROMIUM(
WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback);
+ virtual void setMemoryAllocationChangedCallbackCHROMIUM(
+ WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback);
+
virtual void prepareTexture();
virtual void finish();
virtual void flush();
@@ -196,6 +199,8 @@ class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D {
virtual WebKit::WebGLId NextImageId();
+ void SetMemoryAllocation(WebKit::WebGraphicsMemoryAllocation allocation);
+
protected:
TestWebGraphicsContext3D();
TestWebGraphicsContext3D(
@@ -220,6 +225,8 @@ class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D {
int times_map_buffer_chromium_succeeds_;
WebGraphicsContextLostCallback* context_lost_callback_;
WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* swap_buffers_callback_;
+ WebGraphicsMemoryAllocationChangedCallbackCHROMIUM*
+ memory_allocation_changed_callback_;
std::vector<WebGraphicsSyncPointCallback*> sync_point_callbacks_;
std::vector<WebKit::WebGLId> textures_;
base::hash_set<WebKit::WebGLId> used_textures_;