summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/output/context_provider.h2
-rw-r--r--cc/output/delegating_renderer.cc1
-rw-r--r--cc/output/gl_renderer.cc2
-rw-r--r--cc/output/gl_renderer.h2
-rw-r--r--cc/output/output_surface_unittest.cc6
-rw-r--r--cc/test/layer_tree_test.cc56
-rw-r--r--cc/test/layer_tree_test.h85
-rw-r--r--cc/test/test_context_provider.cc4
-rw-r--r--cc/test/test_context_provider.h3
-rw-r--r--cc/test/test_gles2_interface.cc4
-rw-r--r--cc/test/test_gles2_interface.h1
-rw-r--r--cc/test/test_in_process_context_provider.cc4
-rw-r--r--cc/test/test_in_process_context_provider.h1
-rw-r--r--cc/trees/layer_tree_host_unittest.cc381
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc255
-rw-r--r--cc/trees/layer_tree_host_unittest_delegated.cc5
-rw-r--r--content/browser/android/in_process/synchronous_compositor_factory_impl.cc4
-rw-r--r--content/common/gpu/client/context_provider_command_buffer.cc4
-rw-r--r--content/common/gpu/client/context_provider_command_buffer.h1
-rw-r--r--content/renderer/gpu/compositor_output_surface.cc2
-rw-r--r--content/renderer/media/android/stream_texture_factory_android.h11
-rw-r--r--content/renderer/media/android/stream_texture_factory_android_impl.cc51
-rw-r--r--content/renderer/media/android/stream_texture_factory_android_impl.h22
-rw-r--r--content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc38
-rw-r--r--content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h12
-rw-r--r--content/renderer/media/android/webmediaplayer_android.cc60
-rw-r--r--content/renderer/render_view_impl.cc2
-rw-r--r--mojo/examples/aura_demo/demo_context_factory.cc1
-rw-r--r--mojo/examples/compositor_app/compositor_host.cc1
-rw-r--r--webkit/common/gpu/context_provider_in_process.cc7
-rw-r--r--webkit/common/gpu/context_provider_in_process.h2
31 files changed, 459 insertions, 571 deletions
diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h
index 7f1737a..134e4f5 100644
--- a/cc/output/context_provider.h
+++ b/cc/output/context_provider.h
@@ -12,7 +12,6 @@
class GrContext;
-namespace blink { class WebGraphicsContext3D; }
namespace gpu {
class ContextSupport;
namespace gles2 { class GLES2Interface; }
@@ -29,7 +28,6 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
// from the same thread.
virtual bool BindToCurrentThread() = 0;
- virtual blink::WebGraphicsContext3D* Context3d() = 0;
virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
virtual gpu::ContextSupport* ContextSupport() = 0;
virtual class GrContext* GrContext() = 0;
diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc
index 59e8d63..e56d146 100644
--- a/cc/output/delegating_renderer.cc
+++ b/cc/output/delegating_renderer.cc
@@ -27,7 +27,6 @@
#include "gpu/command_buffer/common/gpu_memory_allocation.h"
#include "third_party/khronos/GLES2/gl2ext.h"
-using blink::WebGraphicsContext3D;
namespace cc {
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 2f3ff6c..771cfea 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -40,7 +40,6 @@
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/gpu_memory_allocation.h"
-#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -55,7 +54,6 @@
#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect_conversions.h"
-using blink::WebGraphicsContext3D;
using gpu::gles2::GLES2Interface;
namespace cc {
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index 3043d30..5feecd4 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -23,8 +23,6 @@
class SkBitmap;
-namespace blink { class WebGraphicsContext3D; }
-
namespace gpu {
namespace gles2 {
class GLES2Interface;
diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc
index 1d13454..73a76a3 100644
--- a/cc/output/output_surface_unittest.cc
+++ b/cc/output/output_surface_unittest.cc
@@ -143,8 +143,9 @@ TEST(OutputSurfaceTest, ClientPointerIndicatesBindToClientSuccess) {
// Verify DidLoseOutputSurface callback is hooked up correctly.
EXPECT_FALSE(client.did_lose_output_surface_called());
- provider->TestContext3d()->loseContextCHROMIUM(
+ output_surface.context_provider()->ContextGL()->LoseContextCHROMIUM(
GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
+ output_surface.context_provider()->ContextGL()->Flush();
EXPECT_TRUE(client.did_lose_output_surface_called());
}
@@ -198,8 +199,9 @@ TEST_F(OutputSurfaceTestInitializeNewContext3d, Success) {
EXPECT_EQ(context_provider_, output_surface_.context_provider());
EXPECT_FALSE(client_.did_lose_output_surface_called());
- context_provider_->TestContext3d()->loseContextCHROMIUM(
+ context_provider_->ContextGL()->LoseContextCHROMIUM(
GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
+ context_provider_->ContextGL()->Flush();
EXPECT_TRUE(client_.did_lose_output_surface_called());
output_surface_.ReleaseGL();
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 8e2906b..36621d0 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -53,12 +53,8 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
LayerTreeHostImplClient* host_impl_client,
Proxy* proxy,
RenderingStatsInstrumentation* stats_instrumentation) {
- return make_scoped_ptr(
- new LayerTreeHostImplForTesting(test_hooks,
- settings,
- host_impl_client,
- proxy,
- stats_instrumentation));
+ return make_scoped_ptr(new LayerTreeHostImplForTesting(
+ test_hooks, settings, host_impl_client, proxy, stats_instrumentation));
}
protected:
@@ -226,9 +222,7 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient,
monotonic_time * base::Time::kMicrosecondsPerSecond));
}
- virtual void Layout() OVERRIDE {
- test_hooks_->Layout();
- }
+ virtual void Layout() OVERRIDE { test_hooks_->Layout(); }
virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
float scale) OVERRIDE {
@@ -250,9 +244,7 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient,
virtual void WillCommit() OVERRIDE { test_hooks_->WillCommit(); }
- virtual void DidCommit() OVERRIDE {
- test_hooks_->DidCommit();
- }
+ virtual void DidCommit() OVERRIDE { test_hooks_->DidCommit(); }
virtual void DidCommitAndDrawFrame() OVERRIDE {
test_hooks_->DidCommitAndDrawFrame();
@@ -319,9 +311,7 @@ class LayerTreeHostForTesting : public LayerTreeHost {
void set_test_started(bool started) { test_started_ = started; }
- virtual void DidDeferCommit() OVERRIDE {
- test_hooks_->DidDeferCommit();
- }
+ virtual void DidDeferCommit() OVERRIDE { test_hooks_->DidDeferCommit(); }
private:
LayerTreeHostForTesting(TestHooks* test_hooks,
@@ -490,8 +480,8 @@ void LayerTreeTest::DoBeginTest() {
// Allow commits to happen once BeginTest() has had a chance to post tasks
// so that those tasks will happen before the first commit.
if (layer_tree_host_) {
- static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get())->
- set_test_started(true);
+ static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get())
+ ->set_test_started(true);
}
}
@@ -540,11 +530,8 @@ void LayerTreeTest::DispatchAddAnimation(Layer* layer_to_receive_animation,
DCHECK(!proxy() || proxy()->IsMainThread());
if (layer_to_receive_animation) {
- AddOpacityTransitionToLayer(layer_to_receive_animation,
- animation_duration,
- 0,
- 0.5,
- true);
+ AddOpacityTransitionToLayer(
+ layer_to_receive_animation, animation_duration, 0, 0.5, true);
}
}
@@ -647,8 +634,8 @@ void LayerTreeTest::RunTest(bool threaded,
// mocked out.
settings_.refresh_rate = 200.0;
if (impl_side_painting) {
- DCHECK(threaded) <<
- "Don't run single thread + impl side painting, it doesn't exist.";
+ DCHECK(threaded)
+ << "Don't run single thread + impl side painting, it doesn't exist.";
settings_.impl_side_painting = true;
}
InitializeSettings(&settings_);
@@ -686,15 +673,21 @@ void LayerTreeTest::RunTestWithImplSidePainting() {
}
scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface(bool fallback) {
- scoped_ptr<FakeOutputSurface> output_surface;
- if (delegating_renderer_)
- output_surface = FakeOutputSurface::CreateDelegating3d();
- else
- output_surface = FakeOutputSurface::Create3d();
+ scoped_ptr<FakeOutputSurface> output_surface =
+ CreateFakeOutputSurfaceForTest(fallback);
+
output_surface_ = output_surface.get();
return output_surface.PassAs<OutputSurface>();
}
+scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurfaceForTest(
+ bool fallback) {
+ if (delegating_renderer_)
+ return FakeOutputSurface::CreateDelegating3d();
+ else
+ return FakeOutputSurface::Create3d();
+}
+
scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() {
if (!compositor_contexts_.get() ||
compositor_contexts_->DestroyedOnMainThread())
@@ -702,4 +695,9 @@ scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() {
return compositor_contexts_;
}
+TestWebGraphicsContext3D* LayerTreeTest::TestContext() {
+ return static_cast<TestContextProvider*>(
+ output_surface_->context_provider().get())->TestContext3d();
+}
+
} // namespace cc
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index 7a9efd3..6d282e9 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -12,7 +12,9 @@
#include "cc/trees/layer_tree_host_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace Webkit { class WebGraphicsContext3D; }
+namespace Webkit {
+class WebGraphicsContext3D;
+}
namespace cc {
class FakeLayerTreeHostClient;
@@ -22,6 +24,7 @@ class LayerTreeHost;
class LayerTreeHostClient;
class LayerTreeHostImpl;
class TestContextProvider;
+class TestWebGraphicsContext3D;
// Used by test stubs to notify the test when something interesting happens.
class TestHooks : public AnimationDelegate {
@@ -34,7 +37,7 @@ class TestHooks : public AnimationDelegate {
virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
const BeginFrameArgs& args) {}
virtual void DidBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
- const BeginFrameArgs& args) {}
+ const BeginFrameArgs& args) {}
virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
bool did_handle) {}
virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {}
@@ -56,8 +59,7 @@ class TestHooks : public AnimationDelegate {
bool has_unfinished_animation) {}
virtual void WillAnimateLayers(LayerTreeHostImpl* host_impl,
base::TimeTicks monotonic_time) {}
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
- float scale) {}
+ virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) {}
virtual void Animate(base::TimeTicks monotonic_time) {}
virtual void WillBeginMainFrame() {}
virtual void DidBeginMainFrame() {}
@@ -77,10 +79,10 @@ class TestHooks : public AnimationDelegate {
virtual base::TimeDelta LowFrequencyAnimationInterval() const;
// Implementation of AnimationDelegate:
- virtual void NotifyAnimationStarted(
- double wall_clock_time,
- base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property) OVERRIDE {}
+ virtual void NotifyAnimationStarted(double wall_clock_time,
+ base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property)
+ OVERRIDE {}
virtual void NotifyAnimationFinished(
double wall_clock_time,
base::TimeTicks monotonic_time,
@@ -183,6 +185,12 @@ class LayerTreeTest : public testing::Test, public TestHooks {
virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) OVERRIDE;
virtual scoped_refptr<ContextProvider> OffscreenContextProvider() OVERRIDE;
+ virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurfaceForTest(
+ bool fallback);
+
+ TestWebGraphicsContext3D* TestContext();
+
+
private:
LayerTreeSettings settings_;
scoped_ptr<LayerTreeHostClientForTesting> client_;
@@ -210,10 +218,10 @@ class LayerTreeTest : public testing::Test, public TestHooks {
} // namespace cc
-#define SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
- TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer) { \
- RunTest(false, false, false); \
- } \
+#define SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
+ TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer) { \
+ RunTest(false, false, false); \
+ } \
class SingleThreadDirectNeedsSemicolon##TEST_FIXTURE_NAME {}
#define SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
@@ -222,8 +230,8 @@ class LayerTreeTest : public testing::Test, public TestHooks {
} \
class SingleThreadDelegatingNeedsSemicolon##TEST_FIXTURE_NAME {}
-#define SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \
- SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
+#define SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \
+ SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME)
#define MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
@@ -231,37 +239,36 @@ class LayerTreeTest : public testing::Test, public TestHooks {
RunTest(true, false, false); \
}
-#define MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
- MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
- TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DirectRenderer_ImplSidePaint) { \
- RunTest(true, false, true); \
- } \
+#define MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
+ MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
+ TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DirectRenderer_ImplSidePaint) { \
+ RunTest(true, false, true); \
+ } \
class MultiThreadDirectNeedsSemicolon##TEST_FIXTURE_NAME {}
-#define MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
- TEST_F(TEST_FIXTURE_NAME, \
- RunMultiThread_DelegatingRenderer_MainThreadPaint) { \
- RunTest(true, true, false); \
+#define MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
+ TEST_F(TEST_FIXTURE_NAME, \
+ RunMultiThread_DelegatingRenderer_MainThreadPaint) { \
+ RunTest(true, true, false); \
}
-#define MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
- MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME)\
- TEST_F(TEST_FIXTURE_NAME, \
- RunMultiThread_DelegatingRenderer_ImplSidePaint) { \
- RunTest(true, true, true); \
- } \
+#define MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
+ MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) TEST_F( \
+ TEST_FIXTURE_NAME, RunMultiThread_DelegatingRenderer_ImplSidePaint) { \
+ RunTest(true, true, true); \
+ } \
class MultiThreadDelegatingNeedsSemicolon##TEST_FIXTURE_NAME {}
-#define MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
- MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \
+#define MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
+ MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \
MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME)
-#define MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
- MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
+#define MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
+ MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME)
#define SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( \
- TEST_FIXTURE_NAME) \
+ TEST_FIXTURE_NAME) \
SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME)
@@ -270,7 +277,7 @@ class LayerTreeTest : public testing::Test, public TestHooks {
MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME)
#define SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F( \
- TEST_FIXTURE_NAME) \
+ TEST_FIXTURE_NAME) \
SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME)
@@ -278,12 +285,12 @@ class LayerTreeTest : public testing::Test, public TestHooks {
SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME)
-#define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
- SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \
+#define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \
+ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \
SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME)
-#define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
- SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
+#define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
+ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME)
#endif // CC_TEST_LAYER_TREE_TEST_H_
diff --git a/cc/test/test_context_provider.cc b/cc/test/test_context_provider.cc
index 9e95d28..f40f8ba 100644
--- a/cc/test/test_context_provider.cc
+++ b/cc/test/test_context_provider.cc
@@ -74,10 +74,6 @@ ContextProvider::Capabilities TestContextProvider::ContextCapabilities() {
return context3d_->test_capabilities();
}
-blink::WebGraphicsContext3D* TestContextProvider::Context3d() {
- return NULL;
-}
-
gpu::gles2::GLES2Interface* TestContextProvider::ContextGL() {
DCHECK(context3d_);
DCHECK(bound_);
diff --git a/cc/test/test_context_provider.h b/cc/test/test_context_provider.h
index 2728d25..d2a0db1 100644
--- a/cc/test/test_context_provider.h
+++ b/cc/test/test_context_provider.h
@@ -14,8 +14,6 @@
#include "cc/test/test_context_support.h"
#include "gpu/command_buffer/client/gles2_interface_stub.h"
-namespace blink { class WebGraphicsContext3D; }
-
namespace cc {
class TestWebGraphicsContext3D;
class TestGLES2Interface;
@@ -31,7 +29,6 @@ class TestContextProvider : public ContextProvider {
virtual bool BindToCurrentThread() OVERRIDE;
virtual Capabilities ContextCapabilities() OVERRIDE;
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
virtual gpu::ContextSupport* ContextSupport() OVERRIDE;
virtual class GrContext* GrContext() OVERRIDE;
diff --git a/cc/test/test_gles2_interface.cc b/cc/test/test_gles2_interface.cc
index b2bf39a..732c8a2 100644
--- a/cc/test/test_gles2_interface.cc
+++ b/cc/test/test_gles2_interface.cc
@@ -369,4 +369,8 @@ void TestGLES2Interface::ResizeCHROMIUM(GLuint width,
test_context_->reshapeWithScaleFactor(width, height, device_scale);
}
+void TestGLES2Interface::LoseContextCHROMIUM(GLenum current, GLenum other) {
+ test_context_->loseContextCHROMIUM(current, other);
+}
+
} // namespace cc
diff --git a/cc/test/test_gles2_interface.h b/cc/test/test_gles2_interface.h
index 40130c2..a52d73e 100644
--- a/cc/test/test_gles2_interface.h
+++ b/cc/test/test_gles2_interface.h
@@ -165,6 +165,7 @@ class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub {
virtual void ResizeCHROMIUM(GLuint width,
GLuint height,
float device_scale) OVERRIDE;
+ virtual void LoseContextCHROMIUM(GLenum current, GLenum other) OVERRIDE;
private:
TestWebGraphicsContext3D* test_context_;
diff --git a/cc/test/test_in_process_context_provider.cc b/cc/test/test_in_process_context_provider.cc
index 14c65d1..0381004 100644
--- a/cc/test/test_in_process_context_provider.cc
+++ b/cc/test/test_in_process_context_provider.cc
@@ -55,10 +55,6 @@ TestInProcessContextProvider::~TestInProcessContextProvider() {
bool TestInProcessContextProvider::BindToCurrentThread() { return true; }
-blink::WebGraphicsContext3D* TestInProcessContextProvider::Context3d() {
- return NULL;
-}
-
gpu::gles2::GLES2Interface* TestInProcessContextProvider::ContextGL() {
return context_->GetImplementation();
}
diff --git a/cc/test/test_in_process_context_provider.h b/cc/test/test_in_process_context_provider.h
index f0d78fb4..bcbcad9 100644
--- a/cc/test/test_in_process_context_provider.h
+++ b/cc/test/test_in_process_context_provider.h
@@ -23,7 +23,6 @@ class TestInProcessContextProvider : public ContextProvider {
TestInProcessContextProvider();
virtual bool BindToCurrentThread() OVERRIDE;
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
virtual gpu::ContextSupport* ContextSupport() OVERRIDE;
virtual class GrContext* GrContext() OVERRIDE;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index d01fbae..aa06373 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -65,8 +65,7 @@ using testing::Mock;
namespace cc {
namespace {
-class LayerTreeHostTest : public LayerTreeTest {
-};
+class LayerTreeHostTest : public LayerTreeTest {};
// Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
// draw with frame 0.
@@ -276,8 +275,7 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
: num_draws_(0),
bounds_(50, 50),
invalid_rect_(10, 10, 20, 20),
- root_layer_(ContentLayer::Create(&client_)) {
- }
+ root_layer_(ContentLayer::Create(&client_)) {}
virtual void BeginTest() OVERRIDE {
root_layer_->SetIsDrawable(true);
@@ -316,9 +314,7 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
num_draws_++;
}
- virtual void AfterTest() OVERRIDE {
- EXPECT_EQ(2, num_draws_);
- }
+ virtual void AfterTest() OVERRIDE { EXPECT_EQ(2, num_draws_); }
private:
int num_draws_;
@@ -348,9 +344,7 @@ class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() == 1)
@@ -408,9 +402,7 @@ class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() == 1)
@@ -645,8 +637,7 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
: num_draws_(0),
bounds_(50, 50),
invalid_rect_(10, 10, 20, 20),
- root_layer_(ContentLayer::Create(&client_)) {
- }
+ root_layer_(ContentLayer::Create(&client_)) {}
virtual void BeginTest() OVERRIDE {
root_layer_->SetIsDrawable(true);
@@ -718,9 +709,7 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
num_draws_++;
}
- virtual void AfterTest() OVERRIDE {
- EXPECT_EQ(5, num_draws_);
- }
+ virtual void AfterTest() OVERRIDE { EXPECT_EQ(5, num_draws_); }
private:
int num_draws_;
@@ -737,8 +726,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw);
class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
public:
LayerTreeHostTestUndrawnLayersDamageLater()
- : root_layer_(ContentLayer::Create(&client_)) {
- }
+ : root_layer_(ContentLayer::Create(&client_)) {}
virtual void SetupTree() OVERRIDE {
root_layer_->SetIsDrawable(true);
@@ -759,9 +747,7 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
@@ -815,7 +801,6 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
}
}
-
virtual void AfterTest() OVERRIDE {}
private:
@@ -1033,7 +1018,7 @@ class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
PostSetNeedsCommitToMainThread();
}
- virtual void BeginCommitOnThread(LayerTreeHostImpl *impl) OVERRIDE {
+ virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE {
EXPECT_EQ(frame_count_with_pending_tree_, 0);
impl->BlockNotifyReadyToActivateForTesting(true);
}
@@ -1103,7 +1088,8 @@ class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest {
// Since we might use a low-resolution clock on Windows, we need to
// make sure that the clock has incremented past first_frame_time_.
- while (first_frame_time_ == gfx::FrameTime::Now()) {}
+ while (first_frame_time_ == gfx::FrameTime::Now()) {
+ }
return;
}
@@ -1132,8 +1118,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterDraw);
// Verifies that StartPageScaleAnimation events propagate correctly
// from LayerTreeHost to LayerTreeHostImpl in the MT compositor.
-class LayerTreeHostTestStartPageScaleAnimation
- : public LayerTreeHostTest {
+class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest {
public:
LayerTreeHostTestStartPageScaleAnimation() {}
@@ -1155,12 +1140,10 @@ class LayerTreeHostTestStartPageScaleAnimation
layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f);
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale)
- OVERRIDE {
+ virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
+ float scale) OVERRIDE {
gfx::Vector2d offset = scroll_layer_->scroll_offset();
scroll_layer_->SetScrollOffset(offset + scroll_delta);
layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f);
@@ -1480,8 +1463,7 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
switch (impl->active_tree()->source_frame_number()) {
case 0:
@@ -1522,8 +1504,7 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
if (drew_frame_ == impl->active_tree()->source_frame_number()) {
EXPECT_EQ(0u, context->NumUsedTextures()) << "For frame " << drew_frame_;
@@ -1559,8 +1540,7 @@ class LayerTreeHostTestDelegatingRendererAtomicCommit
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
switch (impl->active_tree()->source_frame_number()) {
case 0:
@@ -1648,9 +1628,7 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidCommitAndDrawFrame() OVERRIDE {
switch (layer_tree_host()->source_frame_number()) {
@@ -1682,8 +1660,7 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate
virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates);
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
switch (impl->active_tree()->source_frame_number()) {
case 0:
@@ -1773,16 +1750,15 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
EXPECT_LT(impl->active_tree()->source_frame_number(), 5);
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
// Number of textures used for drawing should one per layer except for
// frame 3 where the viewport only contains one layer.
if (impl->active_tree()->source_frame_number() == 3) {
EXPECT_EQ(1u, context->NumUsedTextures());
} else {
- EXPECT_EQ(2u, context->NumUsedTextures()) <<
- "For frame " << impl->active_tree()->source_frame_number();
+ EXPECT_EQ(2u, context->NumUsedTextures())
+ << "For frame " << impl->active_tree()->source_frame_number();
}
context->ResetUsedTextures();
@@ -1889,24 +1865,28 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
Renderer* renderer = host_impl->renderer();
RenderPass::Id surface1_render_pass_id = host_impl->active_tree()
- ->root_layer()->children()[0]->render_surface()->RenderPassId();
- RenderPass::Id surface2_render_pass_id =
- host_impl->active_tree()->root_layer()->children()[0]->children()[0]
- ->render_surface()->RenderPassId();
+ ->root_layer()
+ ->children()[0]
+ ->render_surface()
+ ->RenderPassId();
+ RenderPass::Id surface2_render_pass_id = host_impl->active_tree()
+ ->root_layer()
+ ->children()[0]
+ ->children()[0]
+ ->render_surface()
+ ->RenderPassId();
switch (host_impl->active_tree()->source_frame_number()) {
case 0:
- EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting(
- surface1_render_pass_id));
- EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting(
- surface2_render_pass_id));
+ EXPECT_TRUE(
+ renderer->HasAllocatedResourcesForTesting(surface1_render_pass_id));
+ EXPECT_TRUE(
+ renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id));
// Reduce the memory limit to only fit the root layer and one render
// surface. This prevents any contents drawing into surfaces
@@ -1914,10 +1894,10 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
host_impl->SetMemoryPolicy(ManagedMemoryPolicy(100 * 100 * 4 * 2));
break;
case 1:
- EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting(
- surface1_render_pass_id));
- EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting(
- surface2_render_pass_id));
+ EXPECT_FALSE(
+ renderer->HasAllocatedResourcesForTesting(surface1_render_pass_id));
+ EXPECT_FALSE(
+ renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id));
EndTest();
break;
@@ -1953,8 +1933,7 @@ class EvictionTestLayer : public Layer {
return make_scoped_refptr(new EvictionTestLayer());
}
- virtual bool Update(ResourceUpdateQueue*,
- const OcclusionTracker*) OVERRIDE;
+ virtual bool Update(ResourceUpdateQueue*, const OcclusionTracker*) OVERRIDE;
virtual bool DrawsContent() const OVERRIDE { return true; }
virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
@@ -2446,8 +2425,7 @@ class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
layer_tree_host()->contents_texture_manager()->MemoryUseBytes());
} else {
EXPECT_EQ(
- 0u,
- layer_tree_host()->contents_texture_manager()->MemoryUseBytes());
+ 0u, layer_tree_host()->contents_texture_manager()->MemoryUseBytes());
}
// Make sure that contents textures are marked as having been
@@ -2603,10 +2581,9 @@ class LayerTreeHostTestBeginImplFrameNotification : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
- virtual bool PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- bool result) OVERRIDE {
+ virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ bool result) OVERRIDE {
EndTest();
return true;
}
@@ -2665,8 +2642,8 @@ class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest {
}
}
- virtual void BeginMainFrameAbortedOnThread(
- LayerTreeHostImpl *host_impl, bool did_handle) OVERRIDE {
+ virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
+ bool did_handle) OVERRIDE {
commit_abort_count_++;
// Initiate another abortable commit.
host_impl->SetNeedsCommit();
@@ -2730,16 +2707,13 @@ class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
layer_tree_host()->root_layer()->AddChild(layer);
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
EndTest();
}
- virtual void AfterTest() OVERRIDE {
- }
+ virtual void AfterTest() OVERRIDE {}
FakeContentLayerClient client_;
};
@@ -2813,7 +2787,6 @@ class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
virtual GLuint createTexture() OVERRIDE {
return 1;
}
-
MOCK_METHOD1(activeTexture, void(GLenum texture));
MOCK_METHOD2(bindTexture, void(GLenum target,
GLuint texture_id));
@@ -2832,18 +2805,16 @@ class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
MOCK_METHOD1(deleteTexture, void(GLenum texture));
};
-
class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
protected:
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
- OVERRIDE {
+ virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurfaceForTest(
+ bool fallback) OVERRIDE {
scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned(
new MockIOSurfaceWebGraphicsContext3D);
mock_context_ = mock_context_owned.get();
- scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
- mock_context_owned.PassAs<TestWebGraphicsContext3D>()));
- return output_surface.Pass();
+ return FakeOutputSurface::Create3d(
+ mock_context_owned.PassAs<TestWebGraphicsContext3D>());
}
virtual void SetupTree() OVERRIDE {
@@ -2862,55 +2833,48 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
layer_tree_host()->root_layer()->AddChild(io_surface_layer);
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
// In WillDraw, the IOSurfaceLayer sets up the io surface texture.
- EXPECT_CALL(*mock_context_, activeTexture(_))
- .Times(0);
+ EXPECT_CALL(*mock_context_, activeTexture(_)).Times(0);
EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1))
.Times(AtLeast(1));
- EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
- GL_TEXTURE_MIN_FILTER,
- GL_LINEAR))
- .Times(1);
- EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
- GL_TEXTURE_MAG_FILTER,
- GL_LINEAR))
+ EXPECT_CALL(*mock_context_,
+ texParameteri(
+ GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR))
.Times(1);
- EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
- GL_TEXTURE_WRAP_S,
- GL_CLAMP_TO_EDGE))
- .Times(1);
- EXPECT_CALL(*mock_context_, texParameteri(GL_TEXTURE_RECTANGLE_ARB,
- GL_TEXTURE_WRAP_T,
- GL_CLAMP_TO_EDGE))
+ EXPECT_CALL(*mock_context_,
+ texParameteri(
+ GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR))
.Times(1);
+ EXPECT_CALL(*mock_context_,
+ texParameteri(GL_TEXTURE_RECTANGLE_ARB,
+ GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE)).Times(1);
+ EXPECT_CALL(*mock_context_,
+ texParameteri(GL_TEXTURE_RECTANGLE_ARB,
+ GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE)).Times(1);
- EXPECT_CALL(*mock_context_, texImageIOSurface2DCHROMIUM(
- GL_TEXTURE_RECTANGLE_ARB,
- io_surface_size_.width(),
- io_surface_size_.height(),
- io_surface_id_,
- 0))
- .Times(1);
+ EXPECT_CALL(*mock_context_,
+ texImageIOSurface2DCHROMIUM(GL_TEXTURE_RECTANGLE_ARB,
+ io_surface_size_.width(),
+ io_surface_size_.height(),
+ io_surface_id_,
+ 0)).Times(1);
- EXPECT_CALL(*mock_context_, bindTexture(_, 0))
- .Times(AnyNumber());
+ EXPECT_CALL(*mock_context_, bindTexture(_, 0)).Times(AnyNumber());
}
- virtual bool PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- bool result) OVERRIDE {
+ virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ bool result) OVERRIDE {
Mock::VerifyAndClearExpectations(&mock_context_);
// The io surface layer's texture is drawn.
- EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0))
- .Times(AtLeast(1));
+ EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1));
EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1))
.Times(1);
EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _))
@@ -3068,10 +3032,9 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
EXPECT_LE(2u, layer_impl->append_quads_count());
ImplThreadTaskRunner()->PostTask(
FROM_HERE,
- base::Bind(
- &LayerTreeHostTestDeferredInitialize::ReleaseGLAndRedraw,
- base::Unretained(this),
- base::Unretained(host_impl)));
+ base::Bind(&LayerTreeHostTestDeferredInitialize::ReleaseGLAndRedraw,
+ base::Unretained(this),
+ base::Unretained(host_impl)));
} else if (did_initialize_gl_ && did_release_gl_) {
EXPECT_LE(3u, layer_impl->append_quads_count());
EndTest();
@@ -3085,8 +3048,8 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
static_cast<FakeOutputSurface*>(host_impl->output_surface());
scoped_refptr<TestContextProvider> context_provider =
TestContextProvider::Create(); // Not bound to thread.
- EXPECT_TRUE(fake_output_surface->InitializeAndSetContext3d(
- context_provider, NULL));
+ EXPECT_TRUE(
+ fake_output_surface->InitializeAndSetContext3d(context_provider, NULL));
did_initialize_gl_ = true;
}
@@ -3157,8 +3120,7 @@ class LayerTreeHostTestUIResource : public LayerTreeHostTest {
}
void PerformTest(LayerTreeHostImpl* impl) {
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
int frame = num_commits_;
switch (frame) {
@@ -3240,8 +3202,7 @@ class PushPropertiesCountingLayer : public Layer {
private:
PushPropertiesCountingLayer()
- : push_properties_count_(0),
- persist_needs_push_properties_(false) {
+ : push_properties_count_(0), persist_needs_push_properties_(false) {
SetAnchorPoint(gfx::PointF());
SetBounds(gfx::Size(1, 1));
SetIsDrawable(true);
@@ -3447,9 +3408,7 @@ MULTI_THREAD_TEST_F(LayerTreeHostTestLayersPushProperties);
class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
: public LayerTreeHostTest {
protected:
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void SetupTree() OVERRIDE {
root_ = Layer::Create();
@@ -3951,24 +3910,22 @@ class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest {
EndTest();
break;
}
- return LayerTreeHostTest::PrepareToDrawOnThread(host_impl, frame_data,
- result);
+ return LayerTreeHostTest::PrepareToDrawOnThread(
+ host_impl, frame_data, result);
}
- virtual void AfterTest() OVERRIDE {
- EXPECT_EQ(3, num_commits_);
- }
+ virtual void AfterTest() OVERRIDE { EXPECT_EQ(3, num_commits_); }
void SetCallback(bool enable) {
- output_surface()->SetTreeActivationCallback(enable ?
- base::Bind(&LayerTreeHostTestTreeActivationCallback::ActivationCallback,
- base::Unretained(this)) :
- base::Closure());
+ output_surface()->SetTreeActivationCallback(
+ enable
+ ? base::Bind(
+ &LayerTreeHostTestTreeActivationCallback::ActivationCallback,
+ base::Unretained(this))
+ : base::Closure());
}
- void ActivationCallback() {
- ++callback_count_;
- }
+ void ActivationCallback() { ++callback_count_; }
int num_commits_;
int callback_count_;
@@ -3997,7 +3954,7 @@ class LayerInvalidateCausesDraw : public LayerTreeHostTest {
virtual void DidCommitAndDrawFrame() OVERRIDE {
// After commit, invalidate the layer. This should cause a commit.
if (layer_tree_host()->source_frame_number() == 1)
- invalidate_layer_->SetNeedsDisplay();
+ invalidate_layer_->SetNeedsDisplay();
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
@@ -4241,13 +4198,12 @@ class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest {
settings->default_tile_size = gfx::Size(128, 128);
}
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
- OVERRIDE {
+ virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurfaceForTest(
+ bool fallback) OVERRIDE {
scoped_refptr<TestContextProvider> context_provider =
TestContextProvider::Create();
context_provider->SetMaxTransferBufferUsageBytes(1024 * 1024);
- return FakeOutputSurface::Create3d(context_provider)
- .PassAs<OutputSurface>();
+ return FakeOutputSurface::Create3d(context_provider);
}
virtual void SetupTree() OVERRIDE {
@@ -4260,21 +4216,17 @@ class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest {
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
// Expect that the transfer buffer memory used is equal to the
// MaxTransferBufferUsageBytes value set in CreateOutputSurface.
// NOTE: This is now 1/2 due to raster memory limit in TileManager.
// Only half the limit will be reached unless the task set
// thrashes to a completly new set of tiles.
- EXPECT_EQ(512 * 1024u,
- context->GetPeakTransferBufferMemoryUsedBytes());
+ EXPECT_EQ(512 * 1024u, context->GetPeakTransferBufferMemoryUsedBytes());
EndTest();
}
@@ -4300,38 +4252,38 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest {
switch (frame) {
case 0:
// Verify default values.
- EXPECT_EQ(
- PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
- layer_tree_host()->contents_texture_manager()->
- MaxMemoryLimitBytes());
- EXPECT_EQ(
- PriorityCalculator::AllowEverythingCutoff(),
- layer_tree_host()->contents_texture_manager()->
- ExternalPriorityCutoff());
+ EXPECT_EQ(PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
+ layer_tree_host()
+ ->contents_texture_manager()
+ ->MaxMemoryLimitBytes());
+ EXPECT_EQ(PriorityCalculator::AllowEverythingCutoff(),
+ layer_tree_host()
+ ->contents_texture_manager()
+ ->ExternalPriorityCutoff());
PostSetNeedsCommitToMainThread();
break;
case 1:
// The values should remain the same until the commit after the policy
// is changed.
- EXPECT_EQ(
- PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
- layer_tree_host()->contents_texture_manager()->
- MaxMemoryLimitBytes());
- EXPECT_EQ(
- PriorityCalculator::AllowEverythingCutoff(),
- layer_tree_host()->contents_texture_manager()->
- ExternalPriorityCutoff());
+ EXPECT_EQ(PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
+ layer_tree_host()
+ ->contents_texture_manager()
+ ->MaxMemoryLimitBytes());
+ EXPECT_EQ(PriorityCalculator::AllowEverythingCutoff(),
+ layer_tree_host()
+ ->contents_texture_manager()
+ ->ExternalPriorityCutoff());
break;
case 2:
// Verify values were correctly passed.
- EXPECT_EQ(
- 16u*1024u*1024u,
- layer_tree_host()->contents_texture_manager()->
- MaxMemoryLimitBytes());
- EXPECT_EQ(
- PriorityCalculator::AllowVisibleAndNearbyCutoff(),
- layer_tree_host()->contents_texture_manager()->
- ExternalPriorityCutoff());
+ EXPECT_EQ(16u * 1024u * 1024u,
+ layer_tree_host()
+ ->contents_texture_manager()
+ ->MaxMemoryLimitBytes());
+ EXPECT_EQ(PriorityCalculator::AllowVisibleAndNearbyCutoff(),
+ layer_tree_host()
+ ->contents_texture_manager()
+ ->ExternalPriorityCutoff());
EndTest();
break;
case 3:
@@ -4351,7 +4303,7 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest {
case 1:
// This will trigger a commit because the priority cutoff has changed.
impl->SetMemoryPolicy(ManagedMemoryPolicy(
- 16u*1024u*1024u,
+ 16u * 1024u * 1024u,
gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
1000));
break;
@@ -4359,7 +4311,7 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest {
// This will not trigger a commit because the priority cutoff has not
// changed, and there is already enough memory for all allocations.
impl->SetMemoryPolicy(ManagedMemoryPolicy(
- 32u*1024u*1024u,
+ 32u * 1024u * 1024u,
gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
1000));
break;
@@ -4458,13 +4410,11 @@ class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest {
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
FakeContentLayerImpl* layer_impl =
- static_cast<FakeContentLayerImpl*>(impl->RootLayer());
+ static_cast<FakeContentLayerImpl*>(impl->RootLayer());
EXPECT_FALSE(layer_impl->DrawsContent());
EXPECT_EQ(0u, layer_impl->append_quads_count());
}
@@ -4483,7 +4433,6 @@ class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest {
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForEmptyLayer);
-
} // namespace
class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
@@ -4502,16 +4451,13 @@ class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
second_context_provider_ = TestContextProvider::Create();
}
- scoped_ptr<FakeOutputSurface> output_surface(
- FakeOutputSurface::Create3d(
- second_context_provider_ ?
- second_context_provider_ :
- first_context_provider_));
- output_surface->SetMemoryPolicyToSetAtBind(make_scoped_ptr(
- new ManagedMemoryPolicy(
- second_context_provider_ ?
- second_output_surface_memory_limit_ :
- first_output_surface_memory_limit_,
+ scoped_ptr<FakeOutputSurface> output_surface(FakeOutputSurface::Create3d(
+ second_context_provider_ ? second_context_provider_
+ : first_context_provider_));
+ output_surface->SetMemoryPolicyToSetAtBind(
+ make_scoped_ptr(new ManagedMemoryPolicy(
+ second_context_provider_ ? second_output_surface_memory_limit_
+ : first_output_surface_memory_limit_,
gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
return output_surface.PassAs<OutputSurface>();
@@ -4524,9 +4470,7 @@ class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidCommitAndDrawFrame() OVERRIDE {
// Lost context sometimes takes two frames to recreate. The third frame
@@ -4539,16 +4483,15 @@ class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
}
}
- virtual void SwapBuffersOnThread(LayerTreeHostImpl *impl, bool result)
- OVERRIDE {
+ virtual void SwapBuffersOnThread(LayerTreeHostImpl* impl,
+ bool result) OVERRIDE {
switch (impl->active_tree()->source_frame_number()) {
case 1:
EXPECT_EQ(first_output_surface_memory_limit_,
impl->memory_allocation_limit_bytes());
// Lose the output surface.
first_context_provider_->TestContext3d()->loseContextCHROMIUM(
- GL_GUILTY_CONTEXT_RESET_ARB,
- GL_INNOCENT_CONTEXT_RESET_ARB);
+ GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
break;
case 4:
EXPECT_EQ(second_output_surface_memory_limit_,
@@ -4572,11 +4515,11 @@ SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface);
struct TestSwapPromiseResult {
- TestSwapPromiseResult() : did_swap_called(false),
- did_not_swap_called(false),
- dtor_called(false),
- reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {
- }
+ TestSwapPromiseResult()
+ : did_swap_called(false),
+ did_not_swap_called(false),
+ dtor_called(false),
+ reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {}
bool did_swap_called;
bool did_not_swap_called;
@@ -4587,9 +4530,7 @@ struct TestSwapPromiseResult {
class TestSwapPromise : public SwapPromise {
public:
- explicit TestSwapPromise(TestSwapPromiseResult* result)
- : result_(result) {
- }
+ explicit TestSwapPromise(TestSwapPromiseResult* result) : result_(result) {}
virtual ~TestSwapPromise() {
base::AutoLock lock(result_->lock);
@@ -4616,17 +4557,15 @@ class TestSwapPromise : public SwapPromise {
TestSwapPromiseResult* result_;
};
-class LayerTreeHostTestBreakSwapPromise
- : public LayerTreeHostTest {
+class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest {
protected:
LayerTreeHostTestBreakSwapPromise()
- : commit_count_(0), commit_complete_count_(0) {
- }
+ : commit_count_(0), commit_complete_count_(0) {}
virtual void WillBeginMainFrame() OVERRIDE {
ASSERT_LE(commit_count_, 2);
- scoped_ptr<SwapPromise> swap_promise(new TestSwapPromise(
- &swap_promise_result_[commit_count_]));
+ scoped_ptr<SwapPromise> swap_promise(
+ new TestSwapPromise(&swap_promise_result_[commit_count_]));
layer_tree_host()->QueueSwapPromise(swap_promise.Pass());
}
@@ -4691,7 +4630,6 @@ class LayerTreeHostTestBreakSwapPromise
MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
-
class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
public:
SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,
@@ -4717,9 +4655,8 @@ class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
int* set_needs_redraw_count_;
};
-class LayerTreeHostTestSimpleSwapPromiseMonitor
- : public LayerTreeHostTest {
-
+class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest {
+ public:
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void WillBeginMainFrame() OVERRIDE {
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index b53127d..5aa37fe 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -76,12 +76,12 @@ class LayerTreeHostContextTest : public LayerTreeTest {
return TestWebGraphicsContext3D::Create();
}
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
- OVERRIDE {
+ virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurfaceForTest(
+ bool fallback) OVERRIDE {
if (times_to_fail_create_) {
--times_to_fail_create_;
ExpectCreateToFail();
- return scoped_ptr<OutputSurface>();
+ return scoped_ptr<FakeOutputSurface>();
}
scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d();
@@ -92,12 +92,10 @@ class LayerTreeHostContextTest : public LayerTreeTest {
context3d_->set_have_extension_egl_image(true);
}
- if (delegating_renderer()) {
- return FakeOutputSurface::CreateDelegating3d(context3d.Pass())
- .PassAs<OutputSurface>();
- }
- return FakeOutputSurface::Create3d(context3d.Pass())
- .PassAs<OutputSurface>();
+ if (delegating_renderer())
+ return FakeOutputSurface::CreateDelegating3d(context3d.Pass());
+ else
+ return FakeOutputSurface::Create3d(context3d.Pass());
}
scoped_ptr<TestWebGraphicsContext3D> CreateOffscreenContext3d() {
@@ -170,9 +168,7 @@ class LayerTreeHostContextTest : public LayerTreeTest {
EXPECT_EQ(times_to_expect_create_failed_, times_create_failed_);
}
- void ExpectCreateToFail() {
- ++times_to_expect_create_failed_;
- }
+ void ExpectCreateToFail() { ++times_to_expect_create_failed_; }
protected:
TestWebGraphicsContext3D* context3d_;
@@ -203,9 +199,7 @@ class LayerTreeHostContextTestLostContextSucceeds
recovered_context_(true),
first_initialized_(false) {}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE {
EXPECT_TRUE(succeeded);
@@ -245,67 +239,66 @@ class LayerTreeHostContextTestLostContextSucceeds
bool NextTestCase() {
static const TestCase kTests[] = {
- // Losing the context and failing to recreate it (or losing it again
- // immediately) a small number of times should succeed.
- { 1, // times_to_lose_during_commit
- 0, // times_to_lose_during_draw
- 0, // times_to_fail_recreate
- 0, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- { 0, // times_to_lose_during_commit
- 1, // times_to_lose_during_draw
- 0, // times_to_fail_recreate
- 0, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- { 1, // times_to_lose_during_commit
- 0, // times_to_lose_during_draw
- 3, // times_to_fail_recreate
- 0, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- { 0, // times_to_lose_during_commit
- 1, // times_to_lose_during_draw
- 3, // times_to_fail_recreate
- 0, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- { 1, // times_to_lose_during_commit
- 0, // times_to_lose_during_draw
- 0, // times_to_fail_recreate
- 3, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- { 0, // times_to_lose_during_commit
- 1, // times_to_lose_during_draw
- 0, // times_to_fail_recreate
- 3, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- // Losing the context and recreating it any number of times should
- // succeed.
- { 10, // times_to_lose_during_commit
- 0, // times_to_lose_during_draw
- 0, // times_to_fail_recreate
- 0, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- { 0, // times_to_lose_during_commit
- 10, // times_to_lose_during_draw
- 0, // times_to_fail_recreate
- 0, // times_to_fail_recreate_offscreen
- false, // fallback_context_works
- },
- // Losing the context, failing to reinitialize it, and making a fallback
- // context should work.
- { 0, // times_to_lose_during_commit
- 1, // times_to_lose_during_draw
- 0, // times_to_fail_recreate
- 0, // times_to_fail_recreate_offscreen
- true, // fallback_context_works
- },
- };
+ // Losing the context and failing to recreate it (or losing it again
+ // immediately) a small number of times should succeed.
+ {1, // times_to_lose_during_commit
+ 0, // times_to_lose_during_draw
+ 0, // times_to_fail_recreate
+ 0, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ {0, // times_to_lose_during_commit
+ 1, // times_to_lose_during_draw
+ 0, // times_to_fail_recreate
+ 0, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ {1, // times_to_lose_during_commit
+ 0, // times_to_lose_during_draw
+ 3, // times_to_fail_recreate
+ 0, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ {0, // times_to_lose_during_commit
+ 1, // times_to_lose_during_draw
+ 3, // times_to_fail_recreate
+ 0, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ {1, // times_to_lose_during_commit
+ 0, // times_to_lose_during_draw
+ 0, // times_to_fail_recreate
+ 3, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ {0, // times_to_lose_during_commit
+ 1, // times_to_lose_during_draw
+ 0, // times_to_fail_recreate
+ 3, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ // Losing the context and recreating it any number of times should
+ // succeed.
+ {10, // times_to_lose_during_commit
+ 0, // times_to_lose_during_draw
+ 0, // times_to_fail_recreate
+ 0, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ {0, // times_to_lose_during_commit
+ 10, // times_to_lose_during_draw
+ 0, // times_to_fail_recreate
+ 0, // times_to_fail_recreate_offscreen
+ false, // fallback_context_works
+ },
+ // Losing the context, failing to reinitialize it, and making a fallback
+ // context should work.
+ {0, // times_to_lose_during_commit
+ 1, // times_to_lose_during_draw
+ 0, // times_to_fail_recreate
+ 0, // times_to_fail_recreate_offscreen
+ true, // fallback_context_works
+ }, };
if (test_case_ >= arraysize(kTests))
return false;
@@ -316,8 +309,7 @@ class LayerTreeHostContextTestLostContextSucceeds
times_to_lose_during_commit_ =
kTests[test_case_].times_to_lose_during_commit;
- times_to_lose_during_draw_ =
- kTests[test_case_].times_to_lose_during_draw;
+ times_to_lose_during_draw_ = kTests[test_case_].times_to_lose_during_draw;
times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate;
times_to_fail_recreate_offscreen_ =
kTests[test_case_].times_to_fail_recreate_offscreen;
@@ -636,15 +628,11 @@ class LayerTreeHostContextTestLostContextFails
: public LayerTreeHostContextTest {
public:
LayerTreeHostContextTestLostContextFails()
- : LayerTreeHostContextTest(),
- num_commits_(0),
- first_initialized_(false) {
+ : LayerTreeHostContextTest(), num_commits_(0), first_initialized_(false) {
times_to_lose_during_commit_ = 1;
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidInitializeOutputSurface(bool succeeded) OVERRIDE {
if (first_initialized_) {
@@ -695,18 +683,15 @@ class LayerTreeHostContextTestLostContextAndEvictTextures
LayerTreeHostContextTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
void PostEvictTextures() {
if (HasImplThread()) {
ImplThreadTaskRunner()->PostTask(
FROM_HERE,
- base::Bind(
- &LayerTreeHostContextTestLostContextAndEvictTextures::
- EvictTexturesOnImplThread,
- base::Unretained(this)));
+ base::Bind(&LayerTreeHostContextTestLostContextAndEvictTextures::
+ EvictTexturesOnImplThread,
+ base::Unretained(this)));
} else {
DebugScopedSetImplThread impl(proxy());
EvictTexturesOnImplThread();
@@ -851,9 +836,7 @@ class LayerTreeHostContextTestLostContextWhileUpdatingResources
LayerTreeHostContextTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
EXPECT_EQ(0, times_to_lose_on_end_query_);
@@ -878,12 +861,10 @@ class LayerTreeHostContextTestLostContextWhileUpdatingResources
SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(
LayerTreeHostContextTestLostContextWhileUpdatingResources);
-class LayerTreeHostContextTestLayersNotified
- : public LayerTreeHostContextTest {
+class LayerTreeHostContextTestLayersNotified : public LayerTreeHostContextTest {
public:
LayerTreeHostContextTestLayersNotified()
- : LayerTreeHostContextTest(),
- num_commits_(0) {}
+ : LayerTreeHostContextTest(), num_commits_(0) {}
virtual void SetupTree() OVERRIDE {
root_ = FakeContentLayer::Create(&client_);
@@ -897,19 +878,17 @@ class LayerTreeHostContextTestLayersNotified
LayerTreeHostContextTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl);
FakeContentLayerImpl* root = static_cast<FakeContentLayerImpl*>(
host_impl->active_tree()->root_layer());
- FakeContentLayerImpl* child = static_cast<FakeContentLayerImpl*>(
- root->children()[0]);
- FakeContentLayerImpl* grandchild = static_cast<FakeContentLayerImpl*>(
- child->children()[0]);
+ FakeContentLayerImpl* child =
+ static_cast<FakeContentLayerImpl*>(root->children()[0]);
+ FakeContentLayerImpl* grandchild =
+ static_cast<FakeContentLayerImpl*>(child->children()[0]);
++num_commits_;
switch (num_commits_) {
@@ -948,18 +927,13 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLayersNotified);
class LayerTreeHostContextTestDontUseLostResources
: public LayerTreeHostContextTest {
public:
- LayerTreeHostContextTestDontUseLostResources()
- : lost_context_(false) {
+ LayerTreeHostContextTestDontUseLostResources() : lost_context_(false) {
context_should_support_io_surface_ = true;
child_output_surface_ = FakeOutputSurface::Create3d();
child_output_surface_->BindToClient(&output_surface_client_);
- child_resource_provider_ =
- ResourceProvider::Create(child_output_surface_.get(),
- NULL,
- 0,
- false,
- 1);
+ child_resource_provider_ = ResourceProvider::Create(
+ child_output_surface_.get(), NULL, 0, false, 1);
}
static void EmptyReleaseCallback(unsigned sync_point, bool lost) {}
@@ -1030,9 +1004,9 @@ class LayerTreeHostContextTestDontUseLostResources
texture->SetIsDrawable(true);
texture->SetTextureMailbox(
TextureMailbox(mailbox, sync_point),
- SingleReleaseCallback::Create(base::Bind(
- &LayerTreeHostContextTestDontUseLostResources::
- EmptyReleaseCallback)));
+ SingleReleaseCallback::Create(
+ base::Bind(&LayerTreeHostContextTestDontUseLostResources::
+ EmptyReleaseCallback)));
root->AddChild(texture);
scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_);
@@ -1151,8 +1125,8 @@ class LayerTreeHostContextTestDontUseLostResources
return true;
}
- virtual scoped_ptr<OutputSurface> CreateOutputSurface(
- bool fallback) OVERRIDE {
+ virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
+ OVERRIDE {
// This will get called twice:
// First when we create the initial output surface...
if (layer_tree_host()->source_frame_number() > 0) {
@@ -1175,9 +1149,7 @@ class LayerTreeHostContextTestDontUseLostResources
}
}
- virtual void AfterTest() OVERRIDE {
- EXPECT_TRUE(lost_context_);
- }
+ virtual void AfterTest() OVERRIDE { EXPECT_TRUE(lost_context_); }
private:
FakeContentLayerClient client_;
@@ -1218,8 +1190,8 @@ class LayerTreeHostContextTestCompositeAndReadbackBeforeOutputSurfaceInit
PostSetNeedsCommitToMainThread();
char pixels[4];
- bool result = layer_tree_host()->CompositeAndReadback(
- &pixels, gfx::Rect(1, 1));
+ bool result =
+ layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(1, 1));
EXPECT_EQ(!delegating_renderer(), result);
EXPECT_EQ(1, times_output_surface_created_);
}
@@ -1229,9 +1201,7 @@ class LayerTreeHostContextTestCompositeAndReadbackBeforeOutputSurfaceInit
++times_output_surface_created_;
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
- EndTest();
- }
+ virtual void DidCommitAndDrawFrame() OVERRIDE { EndTest(); }
virtual void AfterTest() OVERRIDE {
// Should not try to create output surface again after successfully
@@ -1485,8 +1455,8 @@ class ScrollbarLayerLostContext : public LayerTreeHostContextTest {
virtual void BeginTest() OVERRIDE {
scoped_refptr<Layer> scroll_layer = Layer::Create();
- scrollbar_layer_ = FakePaintedScrollbarLayer::Create(
- false, true, scroll_layer->id());
+ scrollbar_layer_ =
+ FakePaintedScrollbarLayer::Create(false, true, scroll_layer->id());
scrollbar_layer_->SetBounds(gfx::Size(10, 100));
layer_tree_host()->root_layer()->AddChild(scrollbar_layer_);
layer_tree_host()->root_layer()->AddChild(scroll_layer);
@@ -1554,10 +1524,9 @@ class UIResourceLostTest : public LayerTreeHostContextTest {
void PostStepCompleteToMainThread() {
proxy()->MainThreadTaskRunner()->PostTask(
FROM_HERE,
- base::Bind(
- &UIResourceLostTest::StepCompleteOnMainThreadInternal,
- base::Unretained(this),
- time_step_));
+ base::Bind(&UIResourceLostTest::StepCompleteOnMainThreadInternal,
+ base::Unretained(this),
+ time_step_));
}
void PostLoseContextToImplThread() {
@@ -1565,11 +1534,9 @@ class UIResourceLostTest : public LayerTreeHostContextTest {
base::SingleThreadTaskRunner* task_runner =
HasImplThread() ? ImplThreadTaskRunner()
: base::MessageLoopProxy::current();
- task_runner->PostTask(
- FROM_HERE,
- base::Bind(
- &LayerTreeHostContextTest::LoseContext,
- base::Unretained(this)));
+ task_runner->PostTask(FROM_HERE,
+ base::Bind(&LayerTreeHostContextTest::LoseContext,
+ base::Unretained(this)));
}
protected:
@@ -1671,9 +1638,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostAfterCommit);
// the resource to not exist in the manager.
class UIResourceLostBeforeCommit : public UIResourceLostTestSimple {
public:
- UIResourceLostBeforeCommit()
- : test_id0_(0),
- test_id1_(0) {}
+ UIResourceLostBeforeCommit() : test_id0_(0), test_id1_(0) {}
virtual void StepCompleteOnMainThread(int step) OVERRIDE {
switch (step) {
@@ -1898,8 +1863,7 @@ class UIResourceLostEviction : public UIResourceLostTestSimple {
virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* impl,
bool visible) OVERRIDE {
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
if (!visible) {
// All resources should have been evicted.
ASSERT_EQ(0u, context->NumTextures());
@@ -1915,8 +1879,7 @@ class UIResourceLostEviction : public UIResourceLostTestSimple {
}
virtual void StepCompleteOnImplThread(LayerTreeHostImpl* impl) OVERRIDE {
- TestWebGraphicsContext3D* context = static_cast<TestContextProvider*>(
- impl->output_surface()->context_provider().get())->TestContext3d();
+ TestWebGraphicsContext3D* context = TestContext();
LayerTreeHostContextTest::CommitCompleteOnThread(impl);
switch (time_step_) {
case 1:
@@ -1971,9 +1934,7 @@ class LayerTreeHostContextTestSurfaceCreateCallback
LayerTreeHostContextTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
- PostSetNeedsCommitToMainThread();
- }
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
virtual void DidCommit() OVERRIDE {
switch (num_commits_) {
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index 5ca3bdd..b5c400c 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -342,9 +342,10 @@ class LayerTreeHostDelegatedTestCreateChildId
EXPECT_TRUE(delegated_impl->ChildId());
EXPECT_FALSE(did_reset_child_id_);
- context_provider->TestContext3d()->loseContextCHROMIUM(
+ context_provider->ContextGL()->LoseContextCHROMIUM(
GL_GUILTY_CONTEXT_RESET_ARB,
GL_INNOCENT_CONTEXT_RESET_ARB);
+ context_provider->ContextGL()->Flush();
break;
case 3:
EXPECT_TRUE(delegated_impl->ChildId());
@@ -419,7 +420,7 @@ class LayerTreeHostDelegatedTestInvalidFrameAfterContextLost
++num_activates_;
switch (num_activates_) {
case 2:
- context_provider->TestContext3d()->loseContextCHROMIUM(
+ context_provider->ContextGL()->LoseContextCHROMIUM(
GL_GUILTY_CONTEXT_RESET_ARB,
GL_INNOCENT_CONTEXT_RESET_ARB);
break;
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
index 3c86bd5..4a126dc 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
@@ -32,8 +32,8 @@ class VideoContextProvider
return gl_in_process_context_->GetSurfaceTexture(stream_id);
}
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE {
- return context_provider_->Context3d();
+ virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE {
+ return context_provider_->ContextGL();
}
private:
diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc
index 232b7d8..6535719 100644
--- a/content/common/gpu/client/context_provider_command_buffer.cc
+++ b/content/common/gpu/client/context_provider_command_buffer.cc
@@ -115,10 +115,6 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() {
return true;
}
-blink::WebGraphicsContext3D* ContextProviderCommandBuffer::Context3d() {
- return NULL;
-}
-
gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() {
DCHECK(context3d_);
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
diff --git a/content/common/gpu/client/context_provider_command_buffer.h b/content/common/gpu/client/context_provider_command_buffer.h
index a5f206c..8859d2b 100644
--- a/content/common/gpu/client/context_provider_command_buffer.h
+++ b/content/common/gpu/client/context_provider_command_buffer.h
@@ -43,7 +43,6 @@ class CONTENT_EXPORT ContextProviderCommandBuffer
// cc::ContextProvider implementation.
virtual bool BindToCurrentThread() OVERRIDE;
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
virtual gpu::ContextSupport* ContextSupport() OVERRIDE;
virtual class GrContext* GrContext() OVERRIDE;
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index d44bf6e..7cb5199 100644
--- a/content/renderer/gpu/compositor_output_surface.cc
+++ b/content/renderer/gpu/compositor_output_surface.cc
@@ -121,12 +121,12 @@ void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
}
if (frame->gl_frame_data) {
+ context_provider_->ContextGL()->ShallowFlushCHROMIUM();
ContextProviderCommandBuffer* provider_command_buffer =
static_cast<ContextProviderCommandBuffer*>(context_provider_.get());
CommandBufferProxyImpl* command_buffer_proxy =
provider_command_buffer->GetCommandBufferProxy();
DCHECK(command_buffer_proxy);
- context_provider_->ContextGL()->ShallowFlushCHROMIUM();
command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info);
}
diff --git a/content/renderer/media/android/stream_texture_factory_android.h b/content/renderer/media/android/stream_texture_factory_android.h
index 849cc06..f898d75 100644
--- a/content/renderer/media/android/stream_texture_factory_android.h
+++ b/content/renderer/media/android/stream_texture_factory_android.h
@@ -10,9 +10,12 @@
#include "gpu/command_buffer/common/mailbox.h"
#include "ui/gfx/size.h"
-namespace blink {
-class WebGraphicsContext3D;
-}
+namespace gpu {
+namespace gles2 {
+class GLES2Interface;
+} // namespace gles2
+} // namespace gpu
+
namespace content {
@@ -75,7 +78,7 @@ class StreamTextureFactory {
virtual void SetStreamTextureSize(int32 texture_id,
const gfx::Size& size) = 0;
- virtual blink::WebGraphicsContext3D* Context3d() = 0;
+ virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
};
} // namespace content
diff --git a/content/renderer/media/android/stream_texture_factory_android_impl.cc b/content/renderer/media/android/stream_texture_factory_android_impl.cc
index 3b421ca..cdd5345 100644
--- a/content/renderer/media/android/stream_texture_factory_android_impl.cc
+++ b/content/renderer/media/android/stream_texture_factory_android_impl.cc
@@ -4,10 +4,11 @@
#include "content/renderer/media/android/stream_texture_factory_android_impl.h"
+#include "cc/output/context_provider.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/renderer/gpu/stream_texture_host_android.h"
-#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "ui/gfx/size.h"
namespace content {
@@ -80,11 +81,12 @@ void StreamTextureProxyImpl::OnMatrixChanged(const float matrix[16]) {
} // namespace
StreamTextureFactoryImpl::StreamTextureFactoryImpl(
- blink::WebGraphicsContext3D* context,
+ const scoped_refptr<cc::ContextProvider>& context_provider,
GpuChannelHost* channel,
int view_id)
- : context_(context), channel_(channel), view_id_(view_id) {
- DCHECK(context_);
+ : context_provider_(context_provider),
+ channel_(channel),
+ view_id_(view_id) {
DCHECK(channel);
}
@@ -107,29 +109,28 @@ unsigned StreamTextureFactoryImpl::CreateStreamTexture(
unsigned* texture_id,
gpu::Mailbox* texture_mailbox,
unsigned* texture_mailbox_sync_point) {
- unsigned stream_id = 0;
- if (context_->makeContextCurrent()) {
- *texture_id = context_->createTexture();
- stream_id = context_->createStreamTextureCHROMIUM(*texture_id);
-
- context_->genMailboxCHROMIUM(texture_mailbox->name);
- context_->bindTexture(texture_target, *texture_id);
- context_->produceTextureCHROMIUM(texture_target, texture_mailbox->name);
-
- context_->flush();
- *texture_mailbox_sync_point = context_->insertSyncPoint();
- }
+ GLuint stream_id = 0;
+ gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
+ gl->GenTextures(1, texture_id);
+
+ stream_id = gl->CreateStreamTextureCHROMIUM(*texture_id);
+
+ gl->GenMailboxCHROMIUM(texture_mailbox->name);
+ gl->BindTexture(texture_target, *texture_id);
+ gl->ProduceTextureCHROMIUM(texture_target, texture_mailbox->name);
+
+ gl->Flush();
+ *texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM();
return stream_id;
}
void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) {
- if (context_->makeContextCurrent()) {
- // TODO(sievers): Make the destroyStreamTexture implicit when the last
- // texture referencing it is lost.
- context_->destroyStreamTextureCHROMIUM(texture_id);
- context_->deleteTexture(texture_id);
- context_->flush();
- }
+ gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
+ // TODO(sievers): Make the DestroyStreamTexture implicit when the last
+ // texture referencing it is lost.
+ gl->DestroyStreamTextureCHROMIUM(texture_id);
+ gl->DeleteTextures(1, &texture_id);
+ gl->Flush();
}
void StreamTextureFactoryImpl::SetStreamTextureSize(
@@ -137,8 +138,8 @@ void StreamTextureFactoryImpl::SetStreamTextureSize(
channel_->Send(new GpuChannelMsg_SetStreamTextureSize(stream_id, size));
}
-blink::WebGraphicsContext3D* StreamTextureFactoryImpl::Context3d() {
- return context_;
+gpu::gles2::GLES2Interface* StreamTextureFactoryImpl::ContextGL() {
+ return context_provider_->ContextGL();
}
} // namespace content
diff --git a/content/renderer/media/android/stream_texture_factory_android_impl.h b/content/renderer/media/android/stream_texture_factory_android_impl.h
index 0cd3d58..fccdb67 100644
--- a/content/renderer/media/android/stream_texture_factory_android_impl.h
+++ b/content/renderer/media/android/stream_texture_factory_android_impl.h
@@ -7,19 +7,27 @@
#include "content/renderer/media/android/stream_texture_factory_android.h"
-namespace blink {
-class WebGraphicsContext3D;
+namespace cc {
+class ContextProvider;
}
+namespace gpu {
+namespace gles2 {
+class GLES2Interface;
+} // namespace gles2
+} // namespace gpu
+
+
namespace content {
class GpuChannelHost;
class StreamTextureFactoryImpl : public StreamTextureFactory {
public:
- StreamTextureFactoryImpl(blink::WebGraphicsContext3D* context,
- GpuChannelHost* channel,
- int view_id);
+ StreamTextureFactoryImpl(
+ const scoped_refptr<cc::ContextProvider>& context_provider,
+ GpuChannelHost* channel,
+ int view_id);
virtual ~StreamTextureFactoryImpl();
// StreamTextureFactory implementation.
@@ -33,10 +41,10 @@ class StreamTextureFactoryImpl : public StreamTextureFactory {
virtual void DestroyStreamTexture(unsigned texture_id) OVERRIDE;
virtual void SetStreamTextureSize(int32 texture_id,
const gfx::Size& size) OVERRIDE;
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
+ virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
private:
- blink::WebGraphicsContext3D* context_;
+ scoped_refptr<cc::ContextProvider> context_provider_;
scoped_refptr<GpuChannelHost> channel_;
int view_id_;
diff --git a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc
index c284328..c19b5c6 100644
--- a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc
+++ b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc
@@ -15,9 +15,11 @@
#include "base/synchronization/lock.h"
#include "cc/output/context_provider.h"
#include "content/common/android/surface_texture_peer.h"
-#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "ui/gl/android/surface_texture.h"
+using gpu::gles2::GLES2Interface;
+
namespace content {
namespace {
@@ -154,41 +156,37 @@ unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture(
gpu::Mailbox* texture_mailbox,
unsigned* texture_mailbox_sync_point) {
DCHECK(context_provider_);
- blink::WebGraphicsContext3D* context = context_provider_->Context3d();
unsigned stream_id = 0;
- if (context->makeContextCurrent()) {
- *texture_id = context->createTexture();
- stream_id = context->createStreamTextureCHROMIUM(*texture_id);
+ GLES2Interface* gl = context_provider_->ContextGL();
+ gl->GenTextures(1, texture_id);
+ stream_id = gl->CreateStreamTextureCHROMIUM(*texture_id);
- context->genMailboxCHROMIUM(texture_mailbox->name);
- context->bindTexture(texture_target, *texture_id);
- context->produceTextureCHROMIUM(texture_target, texture_mailbox->name);
+ gl->GenMailboxCHROMIUM(texture_mailbox->name);
+ gl->BindTexture(texture_target, *texture_id);
+ gl->ProduceTextureCHROMIUM(texture_target, texture_mailbox->name);
- context->flush();
- *texture_mailbox_sync_point = context->insertSyncPoint();
- }
+ gl->Flush();
+ *texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM();
return stream_id;
}
void StreamTextureFactorySynchronousImpl::DestroyStreamTexture(
unsigned texture_id) {
DCHECK(context_provider_);
- blink::WebGraphicsContext3D* context = context_provider_->Context3d();
- if (context->makeContextCurrent()) {
- context->destroyStreamTextureCHROMIUM(texture_id);
- context->deleteTexture(texture_id);
- context->flush();
- }
+ GLES2Interface* gl = context_provider_->ContextGL();
+ gl->DestroyStreamTextureCHROMIUM(texture_id);
+ gl->DeleteTextures(1, &texture_id);
+ gl->Flush();
}
void StreamTextureFactorySynchronousImpl::SetStreamTextureSize(
int32 stream_id,
const gfx::Size& size) {}
-blink::WebGraphicsContext3D*
-StreamTextureFactorySynchronousImpl::Context3d() {
+gpu::gles2::GLES2Interface*
+StreamTextureFactorySynchronousImpl::ContextGL() {
DCHECK(context_provider_);
- return context_provider_->Context3d();
+ return context_provider_->ContextGL();
}
} // namespace content
diff --git a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h
index 51c77e5..289d86c 100644
--- a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h
+++ b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h
@@ -13,9 +13,11 @@ namespace gfx {
class SurfaceTexture;
}
-namespace blink {
-class WebGraphicsContext3D;
-}
+namespace gpu {
+namespace gles2 {
+class GLES2Interface;
+} // namespace gles2
+} // namespace gpu
namespace content {
@@ -27,7 +29,7 @@ class StreamTextureFactorySynchronousImpl : public StreamTextureFactory {
virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
uint32 stream_id) = 0;
- virtual blink::WebGraphicsContext3D* Context3d() = 0;
+ virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
protected:
friend class base::RefCountedThreadSafe<ContextProvider>;
@@ -52,7 +54,7 @@ class StreamTextureFactorySynchronousImpl : public StreamTextureFactory {
virtual void DestroyStreamTexture(unsigned texture_id) OVERRIDE;
virtual void SetStreamTextureSize(int32 stream_id,
const gfx::Size& size) OVERRIDE;
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
+ virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
private:
CreateContextProviderCallback create_context_provider_callback_;
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index af0d25b..dccdfbd 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -22,6 +22,7 @@
#include "content/renderer/media/webmediaplayer_util.h"
#include "content/renderer/render_thread_impl.h"
#include "gpu/GLES2/gl2extchromium.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "grit/content_resources.h"
#include "media/base/android/media_player_android.h"
#include "media/base/bind_to_current_loop.h"
@@ -52,6 +53,7 @@ using blink::WebSize;
using blink::WebString;
using blink::WebTimeRanges;
using blink::WebURL;
+using gpu::gles2::GLES2Interface;
using media::MediaPlayerAndroid;
using media::VideoFrame;
@@ -181,10 +183,8 @@ WebMediaPlayerAndroid::~WebMediaPlayerAndroid() {
stream_texture_factory_->DestroyStreamTexture(texture_id_);
if (remote_playback_texture_id_) {
- blink::WebGraphicsContext3D* context =
- stream_texture_factory_->Context3d();
- if (context->makeContextCurrent())
- context->deleteTexture(remote_playback_texture_id_);
+ stream_texture_factory_->ContextGL()->
+ DeleteTextures(1, &remote_playback_texture_id_);
}
if (base::MessageLoop::current())
@@ -929,9 +929,6 @@ void WebMediaPlayerAndroid::DrawRemotePlaybackIcon() {
DCHECK(main_thread_checker_.CalledOnValidThread());
if (!video_weblayer_)
return;
- blink::WebGraphicsContext3D* context = stream_texture_factory_->Context3d();
- if (!context->makeContextCurrent())
- return;
// TODO(johnme): Should redraw this frame if the layer bounds change; but
// there seems no easy way to listen for the layer resizing (as opposed to
@@ -978,33 +975,35 @@ void WebMediaPlayerAndroid::DrawRemotePlaybackIcon() {
canvas.drawBitmapRectToRect(
*icon_bitmap, NULL /* src */, icon_rect /* dest */, &paint);
+ GLES2Interface* gl = stream_texture_factory_->ContextGL();
+
if (!remote_playback_texture_id_)
- remote_playback_texture_id_ = context->createTexture();
- unsigned texture_target = GL_TEXTURE_2D;
- context->bindTexture(texture_target, remote_playback_texture_id_);
- context->texParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- context->texParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- context->texParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- context->texParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ gl->GenTextures(1, &remote_playback_texture_id_);
+ GLuint texture_target = GL_TEXTURE_2D;
+ gl->BindTexture(texture_target, remote_playback_texture_id_);
+ gl->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ gl->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ gl->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ gl->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
{
SkAutoLockPixels lock(bitmap);
- context->texImage2D(texture_target,
- 0 /* level */,
- GL_RGBA /* internalformat */,
- bitmap.width(),
- bitmap.height(),
- 0 /* border */,
- GL_RGBA /* format */,
- GL_UNSIGNED_BYTE /* type */,
- bitmap.getPixels());
+ gl->TexImage2D(texture_target,
+ 0 /* level */,
+ GL_RGBA /* internalformat */,
+ bitmap.width(),
+ bitmap.height(),
+ 0 /* border */,
+ GL_RGBA /* format */,
+ GL_UNSIGNED_BYTE /* type */,
+ bitmap.getPixels());
}
gpu::Mailbox texture_mailbox;
- context->genMailboxCHROMIUM(texture_mailbox.name);
- context->produceTextureCHROMIUM(texture_target, texture_mailbox.name);
- context->flush();
- unsigned texture_mailbox_sync_point = context->insertSyncPoint();
+ gl->GenMailboxCHROMIUM(texture_mailbox.name);
+ gl->ProduceTextureCHROMIUM(texture_target, texture_mailbox.name);
+ gl->Flush();
+ GLuint texture_mailbox_sync_point = gl->InsertSyncPointCHROMIUM();
scoped_refptr<VideoFrame> new_frame = VideoFrame::WrapNativeTexture(
make_scoped_ptr(new VideoFrame::MailboxHolder(
@@ -1444,12 +1443,11 @@ void WebMediaPlayerAndroid::DoReleaseRemotePlaybackTexture(uint32 sync_point) {
DCHECK(main_thread_checker_.CalledOnValidThread());
DCHECK(remote_playback_texture_id_);
- blink::WebGraphicsContext3D* context =
- stream_texture_factory_->Context3d();
+ GLES2Interface* gl = stream_texture_factory_->ContextGL();
if (sync_point)
- context->waitSyncPoint(sync_point);
- context->deleteTexture(remote_playback_texture_id_);
+ gl->WaitSyncPointCHROMIUM(sync_point);
+ gl->DeleteTextures(1, &remote_playback_texture_id_);
remote_playback_texture_id_ = 0;
}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index a511413..ecdd229 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -5994,7 +5994,7 @@ WebMediaPlayer* RenderViewImpl::CreateAndroidWebMediaPlayer(
}
stream_texture_factory.reset(new StreamTextureFactoryImpl(
- context_provider->WebContext3D(), gpu_channel_host, routing_id_));
+ context_provider, gpu_channel_host, routing_id_));
}
scoped_ptr<WebMediaPlayerAndroid> web_media_player_android(
diff --git a/mojo/examples/aura_demo/demo_context_factory.cc b/mojo/examples/aura_demo/demo_context_factory.cc
index 74956aa..64214ca 100644
--- a/mojo/examples/aura_demo/demo_context_factory.cc
+++ b/mojo/examples/aura_demo/demo_context_factory.cc
@@ -27,7 +27,6 @@ class MojoContextProvider : public cc::ContextProvider {
// cc::ContextProvider implementation.
virtual bool BindToCurrentThread() OVERRIDE { return true; }
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE { return NULL; }
virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE {
return gles2_client_impl_->Interface();
}
diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc
index ff6854d..df41fb1 100644
--- a/mojo/examples/compositor_app/compositor_host.cc
+++ b/mojo/examples/compositor_app/compositor_host.cc
@@ -22,7 +22,6 @@ class MojoContextProvider : public cc::ContextProvider {
// cc::ContextProvider implementation.
virtual bool BindToCurrentThread() OVERRIDE { return true; }
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE { return NULL; }
virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE {
return gles2_client_impl_->Interface();
}
diff --git a/webkit/common/gpu/context_provider_in_process.cc b/webkit/common/gpu/context_provider_in_process.cc
index 70d9d34..1e543a5 100644
--- a/webkit/common/gpu/context_provider_in_process.cc
+++ b/webkit/common/gpu/context_provider_in_process.cc
@@ -117,13 +117,6 @@ ContextProviderInProcess::ContextCapabilities() {
return capabilities_;
}
-blink::WebGraphicsContext3D* ContextProviderInProcess::Context3d() {
- DCHECK(lost_context_callback_proxy_); // Is bound to thread.
- DCHECK(context_thread_checker_.CalledOnValidThread());
-
- return context3d_.get();
-}
-
::gpu::gles2::GLES2Interface* ContextProviderInProcess::ContextGL() {
DCHECK(context3d_);
DCHECK(lost_context_callback_proxy_); // Is bound to thread.
diff --git a/webkit/common/gpu/context_provider_in_process.h b/webkit/common/gpu/context_provider_in_process.h
index 2abc7f3..59d5866 100644
--- a/webkit/common/gpu/context_provider_in_process.h
+++ b/webkit/common/gpu/context_provider_in_process.h
@@ -31,9 +31,9 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess
static scoped_refptr<ContextProviderInProcess> CreateOffscreen();
virtual blink::WebGraphicsContext3D* WebContext3D() OVERRIDE;
+
virtual bool BindToCurrentThread() OVERRIDE;
virtual Capabilities ContextCapabilities() OVERRIDE;
- virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE;
virtual ::gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
virtual ::gpu::ContextSupport* ContextSupport() OVERRIDE;
virtual class GrContext* GrContext() OVERRIDE;