summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_output_surface.h
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 00:46:09 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 00:46:09 +0000
commit0634cdd4173783be804661c755cb111e1f49034d (patch)
tree841b3e44e6c0f76a6345fa78b50cbb53c912eb65 /cc/test/fake_output_surface.h
parentfbe4952b1c18689bc7129267d375889cf96cd230 (diff)
downloadchromium_src-0634cdd4173783be804661c755cb111e1f49034d.zip
chromium_src-0634cdd4173783be804661c755cb111e1f49034d.tar.gz
chromium_src-0634cdd4173783be804661c755cb111e1f49034d.tar.bz2
ContextProvider in OutputSurface
Instead of putting a raw WebGraphicsContext3D in the OutputSurface given to the compositor, put a ContextProvider. This requires embedders to create ContextProviders instead of raw contexts. No change in behaviour. Covered by existing tests, including cc/ context loss tests. BUG=258625 R=aelias@chromium.org, jamesr@chromium.org, piman@chromium.org, sievers@chromium.org Review URL: https://codereview.chromium.org/20185002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_output_surface.h')
-rw-r--r--cc/test/fake_output_surface.h61
1 files changed, 34 insertions, 27 deletions
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h
index 12fdcfc..3f87bd3 100644
--- a/cc/test/fake_output_surface.h
+++ b/cc/test/fake_output_surface.h
@@ -6,13 +6,14 @@
#define CC_TEST_FAKE_OUTPUT_SURFACE_H_
#include "base/callback.h"
+#include "base/logging.h"
#include "base/time/time.h"
+#include "cc/debug/test_context_provider.h"
#include "cc/debug/test_web_graphics_context_3d.h"
#include "cc/output/begin_frame_args.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface.h"
#include "cc/output/software_output_device.h"
-#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
namespace cc {
@@ -20,34 +21,42 @@ class FakeOutputSurface : public OutputSurface {
public:
virtual ~FakeOutputSurface();
+ static scoped_ptr<FakeOutputSurface> Create3d() {
+ return make_scoped_ptr(new FakeOutputSurface(
+ TestContextProvider::Create(), false));
+ }
+
static scoped_ptr<FakeOutputSurface> Create3d(
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
- return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false));
+ scoped_refptr<TestContextProvider> context_provider) {
+ return make_scoped_ptr(new FakeOutputSurface(context_provider, false));
}
- static scoped_ptr<FakeOutputSurface> Create3d() {
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d =
- TestWebGraphicsContext3D::Create()
- .PassAs<WebKit::WebGraphicsContext3D>();
- return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false));
+ static scoped_ptr<FakeOutputSurface> Create3d(
+ scoped_ptr<TestWebGraphicsContext3D> context) {
+ return make_scoped_ptr(new FakeOutputSurface(
+ TestContextProvider::Create(context.Pass()), false));
}
static scoped_ptr<FakeOutputSurface> CreateSoftware(
scoped_ptr<SoftwareOutputDevice> software_device) {
- return make_scoped_ptr(
- new FakeOutputSurface(software_device.Pass(), false));
+ return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(),
+ false));
+ }
+
+ static scoped_ptr<FakeOutputSurface> CreateDelegating3d() {
+ return make_scoped_ptr(new FakeOutputSurface(
+ TestContextProvider::Create(), true));
}
static scoped_ptr<FakeOutputSurface> CreateDelegating3d(
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
- return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true));
+ scoped_refptr<TestContextProvider> context_provider) {
+ return make_scoped_ptr(new FakeOutputSurface(context_provider, true));
}
- static scoped_ptr<FakeOutputSurface> CreateDelegating3d() {
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d =
- TestWebGraphicsContext3D::Create()
- .PassAs<WebKit::WebGraphicsContext3D>();
- return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true));
+ static scoped_ptr<FakeOutputSurface> CreateDelegating3d(
+ scoped_ptr<TestWebGraphicsContext3D> context) {
+ return make_scoped_ptr(new FakeOutputSurface(
+ TestContextProvider::Create(context.Pass()), true));
}
static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware(
@@ -66,9 +75,9 @@ class FakeOutputSurface : public OutputSurface {
}
static scoped_ptr<FakeOutputSurface> CreateAlwaysDrawAndSwap3d() {
- scoped_ptr<FakeOutputSurface> result(Create3d());
- result->capabilities_.draw_and_swap_full_viewport_every_frame = true;
- return result.Pass();
+ scoped_ptr<FakeOutputSurface> surface(Create3d());
+ surface->capabilities_.draw_and_swap_full_viewport_every_frame = true;
+ return surface.Pass();
}
CompositorFrame& last_sent_frame() { return last_sent_frame_; }
@@ -88,10 +97,8 @@ class FakeOutputSurface : public OutputSurface {
virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE;
- bool SetAndInitializeContext3D(
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
-
using OutputSurface::ReleaseGL;
+ using OutputSurface::InitializeAndSetContext3d;
void SetTreeActivationCallback(const base::Closure& callback);
@@ -103,7 +110,7 @@ class FakeOutputSurface : public OutputSurface {
protected:
FakeOutputSurface(
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
+ scoped_refptr<ContextProvider> context_provider,
bool delegated_rendering);
FakeOutputSurface(
@@ -111,7 +118,7 @@ class FakeOutputSurface : public OutputSurface {
bool delegated_rendering);
FakeOutputSurface(
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
+ scoped_refptr<ContextProvider> context_provider,
scoped_ptr<SoftwareOutputDevice> software_device,
bool delegated_rendering);
@@ -126,8 +133,8 @@ class FakeOutputSurface : public OutputSurface {
TransferableResourceArray resources_held_by_parent_;
};
-static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() {
- return FakeOutputSurface::Create3d().PassAs<cc::OutputSurface>();
+static inline scoped_ptr<OutputSurface> CreateFakeOutputSurface() {
+ return FakeOutputSurface::Create3d().PassAs<OutputSurface>();
}
} // namespace cc