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

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

Issue 16833003: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « cc/test/fake_layer_tree_host_impl_client.h ('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/time.h" 8 #include "base/time.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/output_surface.h" 10 #include "cc/output/output_surface.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 CompositorFrame& last_sent_frame() { return last_sent_frame_; } 68 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
69 size_t num_sent_frames() { return num_sent_frames_; } 69 size_t num_sent_frames() { return num_sent_frames_; }
70 70
71 virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE; 71 virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE;
72 72
73 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; 73 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
74 bool needs_begin_frame() const { 74 bool needs_begin_frame() const {
75 return needs_begin_frame_; 75 return needs_begin_frame_;
76 } 76 }
77 void BeginFrame(base::TimeTicks frame_time);
78 77
79 void set_forced_draw_to_software_device(bool forced) { 78 void set_forced_draw_to_software_device(bool forced) {
80 forced_draw_to_software_device_ = forced; 79 forced_draw_to_software_device_ = forced;
81 } 80 }
82 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; 81 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
83 82
84 protected: 83 protected:
85 FakeOutputSurface( 84 FakeOutputSurface(
86 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 85 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
87 bool delegated_rendering); 86 bool delegated_rendering);
88 87
89 FakeOutputSurface( 88 FakeOutputSurface(
90 scoped_ptr<SoftwareOutputDevice> software_device, 89 scoped_ptr<SoftwareOutputDevice> software_device,
91 bool delegated_rendering); 90 bool delegated_rendering);
92 91
93 FakeOutputSurface( 92 FakeOutputSurface(
94 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 93 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
95 scoped_ptr<SoftwareOutputDevice> software_device, 94 scoped_ptr<SoftwareOutputDevice> software_device,
96 bool delegated_rendering); 95 bool delegated_rendering);
97 96
97 void OnBeginFrame();
98
98 CompositorFrame last_sent_frame_; 99 CompositorFrame last_sent_frame_;
99 size_t num_sent_frames_; 100 size_t num_sent_frames_;
100 bool needs_begin_frame_; 101 bool needs_begin_frame_;
101 bool forced_draw_to_software_device_; 102 bool forced_draw_to_software_device_;
103 base::WeakPtrFactory<FakeOutputSurface> fake_weak_ptr_factory_;
102 }; 104 };
103 105
104 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { 106 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() {
105 return FakeOutputSurface::Create3d( 107 return FakeOutputSurface::Create3d(
106 TestWebGraphicsContext3D::Create( 108 TestWebGraphicsContext3D::Create(
107 WebKit::WebGraphicsContext3D::Attributes()) 109 WebKit::WebGraphicsContext3D::Attributes())
108 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); 110 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>();
109 } 111 }
110 112
111 } // namespace cc 113 } // namespace cc
112 114
113 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 115 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_impl_client.h ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698