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

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

Issue 12674030: cc: Hook vsync time source to output surface (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 7 years, 9 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 "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/output_surface.h" 9 #include "cc/output/output_surface.h"
10 #include "cc/output/software_output_device.h" 10 #include "cc/output/software_output_device.h"
11 #include "cc/test/test_web_graphics_context_3d.h" 11 #include "cc/test/test_web_graphics_context_3d.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
13 13
14 namespace base {
15 class TimeTicks;
jamesr 2013/03/23 00:35:29 Just include base/time.h
Sami 2013/03/25 13:58:33 Done.
16 }
17
14 namespace cc { 18 namespace cc {
15 19
16 class FakeOutputSurface : public OutputSurface { 20 class FakeOutputSurface : public OutputSurface {
17 public: 21 public:
18 virtual ~FakeOutputSurface(); 22 virtual ~FakeOutputSurface();
19 23
20 static scoped_ptr<FakeOutputSurface> Create3d( 24 static scoped_ptr<FakeOutputSurface> Create3d(
21 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { 25 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
22 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); 26 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false));
23 } 27 }
(...skipping 30 matching lines...) Expand all
54 return make_scoped_ptr( 58 return make_scoped_ptr(
55 new FakeOutputSurface(software_device.Pass(), true)); 59 new FakeOutputSurface(software_device.Pass(), true));
56 } 60 }
57 61
58 virtual bool BindToClient(OutputSurfaceClient*) OVERRIDE; 62 virtual bool BindToClient(OutputSurfaceClient*) OVERRIDE;
59 virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE; 63 virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE;
60 64
61 CompositorFrame& last_sent_frame() { return last_sent_frame_; } 65 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
62 size_t num_sent_frames() { return num_sent_frames_; } 66 size_t num_sent_frames() { return num_sent_frames_; }
63 67
68 virtual void EnableVSyncNotification(bool enable) OVERRIDE;
69 bool vsync_notification_enabled() const {
70 return vsync_notification_enabled_;
71 }
72 void DidVSync(base::TimeTicks frame_time);
73
64 private: 74 private:
65 FakeOutputSurface( 75 FakeOutputSurface(
66 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 76 scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
67 bool has_parent); 77 bool has_parent);
68 78
69 FakeOutputSurface( 79 FakeOutputSurface(
70 scoped_ptr<SoftwareOutputDevice> software_device, 80 scoped_ptr<SoftwareOutputDevice> software_device,
71 bool has_parent); 81 bool has_parent);
72 82
73 CompositorFrame last_sent_frame_; 83 CompositorFrame last_sent_frame_;
74 size_t num_sent_frames_; 84 size_t num_sent_frames_;
85 bool vsync_notification_enabled_;
75 }; 86 };
76 87
77 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { 88 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() {
78 return FakeOutputSurface::Create3d( 89 return FakeOutputSurface::Create3d(
79 TestWebGraphicsContext3D::Create( 90 TestWebGraphicsContext3D::Create(
80 WebKit::WebGraphicsContext3D::Attributes()) 91 WebKit::WebGraphicsContext3D::Attributes())
81 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); 92 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>();
82 } 93 }
83 94
84 } // namespace cc 95 } // namespace cc
85 96
86 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698