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

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

Issue 11833009: Provide a vsync notification to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 10 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/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/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "cc/compositor_frame.h" 10 #include "cc/compositor_frame.h"
11 #include "cc/output_surface.h" 11 #include "cc/output_surface.h"
12 #include "cc/test/fake_software_output_device.h" 12 #include "cc/test/fake_software_output_device.h"
13 #include "cc/test/fake_web_graphics_context_3d.h" 13 #include "cc/test/fake_web_graphics_context_3d.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
15 15
16 namespace base {
17 class TimeTicks;
18 }
19
16 namespace cc { 20 namespace cc {
17 21
18 class FakeOutputSurface : public OutputSurface { 22 class FakeOutputSurface : public OutputSurface {
19 public: 23 public:
20 virtual ~FakeOutputSurface(); 24 virtual ~FakeOutputSurface();
21 25
22 static inline scoped_ptr<FakeOutputSurface> Create3d( 26 static inline scoped_ptr<FakeOutputSurface> Create3d(
23 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { 27 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
24 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); 28 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false));
25 } 29 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 virtual const struct Capabilities& Capabilities() const OVERRIDE; 66 virtual const struct Capabilities& Capabilities() const OVERRIDE;
63 67
64 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; 68 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE;
65 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; 69 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE;
66 70
67 virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE; 71 virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE;
68 72
69 CompositorFrame& last_sent_frame() { return last_sent_frame_; } 73 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
70 size_t num_sent_frames() { return num_sent_frames_; } 74 size_t num_sent_frames() { return num_sent_frames_; }
71 75
76 virtual void EnableVSyncNotification(bool enable) OVERRIDE;
77 bool vsync_notification_enabled() const {
78 return vsync_notification_enabled_;
79 }
80 void DidVSync(base::TimeTicks frame_time);
81
72 private: 82 private:
73 explicit FakeOutputSurface( 83 explicit FakeOutputSurface(
74 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent); 84 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent);
75 explicit FakeOutputSurface( 85 explicit FakeOutputSurface(
76 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent); 86 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent);
77 87
78 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; 88 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
79 scoped_ptr<SoftwareOutputDevice> software_device_; 89 scoped_ptr<SoftwareOutputDevice> software_device_;
80 struct Capabilities capabilities_; 90 struct Capabilities capabilities_;
81 OutputSurfaceClient* client_; 91 OutputSurfaceClient* client_;
82 CompositorFrame last_sent_frame_; 92 CompositorFrame last_sent_frame_;
83 size_t num_sent_frames_; 93 size_t num_sent_frames_;
94 bool vsync_notification_enabled_;
84 }; 95 };
85 96
86 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() 97 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface()
87 { 98 {
88 return FakeOutputSurface::Create3d( 99 return FakeOutputSurface::Create3d(
89 FakeWebGraphicsContext3D::Create( 100 FakeWebGraphicsContext3D::Create(
90 WebKit::WebGraphicsContext3D::Attributes()) 101 WebKit::WebGraphicsContext3D::Attributes())
91 .PassAs<WebKit::WebGraphicsContext3D>()) 102 .PassAs<WebKit::WebGraphicsContext3D>())
92 .PassAs<cc::OutputSurface>(); 103 .PassAs<cc::OutputSurface>();
93 } 104 }
94 105
95 } // namespace cc 106 } // namespace cc
96 107
97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 108 #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