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

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

Issue 12545018: Move context-related callbacks into OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unit test Created 7 years, 8 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_output_surface.h ('k') | cc/test/pixel_test.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 #include "cc/test/fake_output_surface.h" 5 #include "cc/test/fake_output_surface.h"
6 6
7 #include "cc/output/output_surface_client.h" 7 #include "cc/output/output_surface_client.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 FakeOutputSurface::FakeOutputSurface( 11 FakeOutputSurface::FakeOutputSurface(
12 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) 12 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent)
13 : OutputSurface(context3d.Pass()), 13 : OutputSurface(context3d.Pass()),
14 num_sent_frames_(0), 14 num_sent_frames_(0),
15 vsync_notification_enabled_(false) { 15 vsync_notification_enabled_(false) {
16 capabilities_.has_parent_compositor = has_parent; 16 capabilities_.has_parent_compositor = has_parent;
17 } 17 }
18 18
19 FakeOutputSurface::FakeOutputSurface( 19 FakeOutputSurface::FakeOutputSurface(
20 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) 20 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent)
21 : OutputSurface(software_device.Pass()), 21 : OutputSurface(software_device.Pass()),
22 num_sent_frames_(0) { 22 num_sent_frames_(0) {
23 capabilities_.has_parent_compositor = has_parent; 23 capabilities_.has_parent_compositor = has_parent;
24 } 24 }
25 25
26 FakeOutputSurface::~FakeOutputSurface() {} 26 FakeOutputSurface::~FakeOutputSurface() {}
27 27
28 bool FakeOutputSurface::BindToClient(
29 cc::OutputSurfaceClient* client) {
30 DCHECK(client);
31 client_ = client;
32 if (!context3d_)
33 return true;
34 return context3d_->makeContextCurrent();
35 }
36
37 void FakeOutputSurface::SendFrameToParentCompositor( 28 void FakeOutputSurface::SendFrameToParentCompositor(
38 CompositorFrame* frame) { 29 CompositorFrame* frame) {
39 frame->AssignTo(&last_sent_frame_); 30 frame->AssignTo(&last_sent_frame_);
40 ++num_sent_frames_; 31 ++num_sent_frames_;
41 } 32 }
42 33
43 void FakeOutputSurface::EnableVSyncNotification(bool enable) { 34 void FakeOutputSurface::EnableVSyncNotification(bool enable) {
44 vsync_notification_enabled_ = enable; 35 vsync_notification_enabled_ = enable;
45 } 36 }
46 37
47 void FakeOutputSurface::DidVSync(base::TimeTicks frame_time) { 38 void FakeOutputSurface::DidVSync(base::TimeTicks frame_time) {
48 client_->DidVSync(frame_time); 39 client_->DidVSync(frame_time);
49 } 40 }
50 41
51 } // namespace cc 42 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/pixel_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698