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

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

Issue 16304003: Unified OutputSurface::SwapBuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SynchronousCompositorOutputSurface::DemandDrawSw Created 7 years, 6 months 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/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 static scoped_ptr<FakeOutputSurface> CreateDeferredGL( 60 static scoped_ptr<FakeOutputSurface> CreateDeferredGL(
61 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 61 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
62 scoped_ptr<SoftwareOutputDevice> software_device) { 62 scoped_ptr<SoftwareOutputDevice> software_device) {
63 scoped_ptr<FakeOutputSurface> result( 63 scoped_ptr<FakeOutputSurface> result(
64 new FakeOutputSurface(context3d.Pass(), software_device.Pass(), false)); 64 new FakeOutputSurface(context3d.Pass(), software_device.Pass(), false));
65 result->capabilities_.deferred_gl_initialization = true; 65 result->capabilities_.deferred_gl_initialization = true;
66 return result.Pass(); 66 return result.Pass();
67 } 67 }
68 68
69 virtual void SendFrameToParentCompositor(CompositorFrame* frame) OVERRIDE;
70
71 CompositorFrame& last_sent_frame() { return last_sent_frame_; } 69 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
72 size_t num_sent_frames() { return num_sent_frames_; } 70 size_t num_sent_frames() { return num_sent_frames_; }
73 71
72 virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE;
73
74 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; 74 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
75 bool needs_begin_frame() const { 75 bool needs_begin_frame() const {
76 return needs_begin_frame_; 76 return needs_begin_frame_;
77 } 77 }
78 void BeginFrame(base::TimeTicks frame_time); 78 void BeginFrame(base::TimeTicks frame_time);
79 79
80 void set_forced_draw_to_software_device(bool forced) { 80 void set_forced_draw_to_software_device(bool forced) {
81 forced_draw_to_software_device_ = forced; 81 forced_draw_to_software_device_ = forced;
82 } 82 }
83 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; 83 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
84 84
85 protected: 85 protected:
86 FakeOutputSurface( 86 FakeOutputSurface(
87 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 87 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
88 bool has_parent); 88 bool delegated_rendering);
89 89
90 FakeOutputSurface( 90 FakeOutputSurface(
91 scoped_ptr<SoftwareOutputDevice> software_device, 91 scoped_ptr<SoftwareOutputDevice> software_device,
92 bool has_parent); 92 bool delegated_rendering);
93 93
94 FakeOutputSurface( 94 FakeOutputSurface(
95 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 95 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
96 scoped_ptr<SoftwareOutputDevice> software_device, 96 scoped_ptr<SoftwareOutputDevice> software_device,
97 bool has_parent); 97 bool delegated_rendering);
98 98
99 void SendFrameAck(); 99 void SendFrameAck();
100 100
101 CompositorFrame last_sent_frame_; 101 CompositorFrame last_sent_frame_;
102 size_t num_sent_frames_; 102 size_t num_sent_frames_;
103 bool needs_begin_frame_; 103 bool needs_begin_frame_;
104 bool forced_draw_to_software_device_; 104 bool forced_draw_to_software_device_;
105 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; 105 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_;
106 }; 106 };
107 107
108 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { 108 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() {
109 return FakeOutputSurface::Create3d( 109 return FakeOutputSurface::Create3d(
110 TestWebGraphicsContext3D::Create( 110 TestWebGraphicsContext3D::Create(
111 WebKit::WebGraphicsContext3D::Attributes()) 111 WebKit::WebGraphicsContext3D::Attributes())
112 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); 112 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>();
113 } 113 }
114 114
115 } // namespace cc 115 } // namespace cc
116 116
117 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 117 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698