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

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: Rebase to 205473 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
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
9 #include "base/time.h" 8 #include "base/time.h"
10 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
11 #include "cc/output/output_surface.h" 10 #include "cc/output/output_surface.h"
12 #include "cc/output/software_output_device.h" 11 #include "cc/output/software_output_device.h"
13 #include "cc/test/test_web_graphics_context_3d.h" 12 #include "cc/test/test_web_graphics_context_3d.h"
14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
15 14
16 namespace cc { 15 namespace cc {
17 16
18 class FakeOutputSurface : public OutputSurface { 17 class FakeOutputSurface : public OutputSurface {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 58
60 static scoped_ptr<FakeOutputSurface> CreateDeferredGL( 59 static scoped_ptr<FakeOutputSurface> CreateDeferredGL(
61 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 60 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
62 scoped_ptr<SoftwareOutputDevice> software_device) { 61 scoped_ptr<SoftwareOutputDevice> software_device) {
63 scoped_ptr<FakeOutputSurface> result( 62 scoped_ptr<FakeOutputSurface> result(
64 new FakeOutputSurface(context3d.Pass(), software_device.Pass(), false)); 63 new FakeOutputSurface(context3d.Pass(), software_device.Pass(), false));
65 result->capabilities_.deferred_gl_initialization = true; 64 result->capabilities_.deferred_gl_initialization = true;
66 return result.Pass(); 65 return result.Pass();
67 } 66 }
68 67
69 virtual void SendFrameToParentCompositor(CompositorFrame* frame) OVERRIDE;
70
71 CompositorFrame& last_sent_frame() { return last_sent_frame_; } 68 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
72 size_t num_sent_frames() { return num_sent_frames_; } 69 size_t num_sent_frames() { return num_sent_frames_; }
73 70
71 virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE;
72
74 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; 73 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
75 bool needs_begin_frame() const { 74 bool needs_begin_frame() const {
76 return needs_begin_frame_; 75 return needs_begin_frame_;
77 } 76 }
78 void BeginFrame(base::TimeTicks frame_time); 77 void BeginFrame(base::TimeTicks frame_time);
79 78
80 void set_forced_draw_to_software_device(bool forced) { 79 void set_forced_draw_to_software_device(bool forced) {
81 forced_draw_to_software_device_ = forced; 80 forced_draw_to_software_device_ = forced;
82 } 81 }
83 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; 82 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
84 83
85 protected: 84 protected:
86 FakeOutputSurface( 85 FakeOutputSurface(
87 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 86 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
88 bool has_parent); 87 bool delegated_rendering);
89 88
90 FakeOutputSurface( 89 FakeOutputSurface(
91 scoped_ptr<SoftwareOutputDevice> software_device, 90 scoped_ptr<SoftwareOutputDevice> software_device,
92 bool has_parent); 91 bool delegated_rendering);
93 92
94 FakeOutputSurface( 93 FakeOutputSurface(
95 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 94 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
96 scoped_ptr<SoftwareOutputDevice> software_device, 95 scoped_ptr<SoftwareOutputDevice> software_device,
97 bool has_parent); 96 bool delegated_rendering);
98
99 void SendFrameAck();
100 97
101 CompositorFrame last_sent_frame_; 98 CompositorFrame last_sent_frame_;
102 size_t num_sent_frames_; 99 size_t num_sent_frames_;
103 bool needs_begin_frame_; 100 bool needs_begin_frame_;
104 bool forced_draw_to_software_device_; 101 bool forced_draw_to_software_device_;
105 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_;
106 }; 102 };
107 103
108 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { 104 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() {
109 return FakeOutputSurface::Create3d( 105 return FakeOutputSurface::Create3d(
110 TestWebGraphicsContext3D::Create( 106 TestWebGraphicsContext3D::Create(
111 WebKit::WebGraphicsContext3D::Attributes()) 107 WebKit::WebGraphicsContext3D::Attributes())
112 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); 108 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>();
113 } 109 }
114 110
115 } // namespace cc 111 } // namespace cc
116 112
117 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 113 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698