Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Side by Side Diff: cc/test/fake_output_surface.h

Issue 11464007: Add the DelegatingRenderer class with its initialize path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize() Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "cc/output_surface.h" 10 #include "cc/output_surface.h"
11 #include "cc/test/compositor_fake_web_graphics_context_3d.h" 11 #include "cc/test/compositor_fake_web_graphics_context_3d.h"
12 #include "cc/test/fake_software_output_device.h" 12 #include "cc/test/fake_software_output_device.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 class FakeOutputSurface : public OutputSurface { 17 class FakeOutputSurface : public OutputSurface {
18 public: 18 public:
19 virtual ~FakeOutputSurface(); 19 virtual ~FakeOutputSurface();
20 20
21 static inline scoped_ptr<FakeOutputSurface> Create3d( 21 static inline scoped_ptr<FakeOutputSurface> Create3d(
22 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { 22 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
23 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass())); 23 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false));
24 } 24 }
25 25
26 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( 26 static inline scoped_ptr<FakeOutputSurface> CreateSoftware(
27 scoped_ptr<SoftwareOutputDevice> software_device) { 27 scoped_ptr<SoftwareOutputDevice> software_device) {
28 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass())); 28 return make_scoped_ptr(
29 new FakeOutputSurface(software_device.Pass(), false));
30 }
31
32 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d(
33 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
34 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true));
35 }
36
37 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware(
38 scoped_ptr<SoftwareOutputDevice> software_device) {
39 return make_scoped_ptr(
40 new FakeOutputSurface(software_device.Pass(), true));
29 } 41 }
30 42
31 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; 43 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE;
32 44
33 virtual const struct Capabilities& Capabilities() const OVERRIDE; 45 virtual const struct Capabilities& Capabilities() const OVERRIDE;
34 46
35 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; 47 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE;
36 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; 48 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE;
37 49
38 virtual void SendFrameToParentCompositor(const CompositorFrame&) OVERRIDE; 50 virtual void SendFrameToParentCompositor(const CompositorFrame&) OVERRIDE;
39 51
40 private: 52 private:
41 explicit FakeOutputSurface( 53 explicit FakeOutputSurface(
42 scoped_ptr<WebKit::WebGraphicsContext3D> context3d); 54 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent);
43 explicit FakeOutputSurface( 55 explicit FakeOutputSurface(
44 scoped_ptr<SoftwareOutputDevice> software_device); 56 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent);
45 57
46 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; 58 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
47 scoped_ptr<SoftwareOutputDevice> software_device_; 59 scoped_ptr<SoftwareOutputDevice> software_device_;
48 struct Capabilities capabilities_; 60 struct Capabilities capabilities_;
49 OutputSurfaceClient* client_; 61 OutputSurfaceClient* client_;
50 }; 62 };
51 63
52 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() 64 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface()
53 { 65 {
54 return FakeOutputSurface::Create3d( 66 return FakeOutputSurface::Create3d(
55 WebKit::CompositorFakeWebGraphicsContext3D::create( 67 WebKit::CompositorFakeWebGraphicsContext3D::create(
56 WebKit::WebGraphicsContext3D::Attributes()) 68 WebKit::WebGraphicsContext3D::Attributes())
57 .PassAs<WebKit::WebGraphicsContext3D>()) 69 .PassAs<WebKit::WebGraphicsContext3D>())
58 .PassAs<cc::OutputSurface>(); 70 .PassAs<cc::OutputSurface>();
59 } 71 }
60 72
61 } // namespace cc 73 } // namespace cc
62 74
63 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 75 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698