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

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

Issue 16430005: Call OnSwapBuffersComplete at the end of each frame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tidy Begin/End Paint 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "cc/output/compositor_frame_ack.h" 9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
(...skipping 23 matching lines...) Expand all
34 34
35 void FakeOutputSurface::SendFrameToParentCompositor( 35 void FakeOutputSurface::SendFrameToParentCompositor(
36 CompositorFrame* frame) { 36 CompositorFrame* frame) {
37 frame->AssignTo(&last_sent_frame_); 37 frame->AssignTo(&last_sent_frame_);
38 ++num_sent_frames_; 38 ++num_sent_frames_;
39 base::MessageLoop::current()->PostTask( 39 base::MessageLoop::current()->PostTask(
40 FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck, 40 FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck,
41 weak_ptr_factory_.GetWeakPtr())); 41 weak_ptr_factory_.GetWeakPtr()));
42 } 42 }
43 43
44 void FakeOutputSurface::SwapBuffers(const ui::LatencyInfo& latency_info) {
45 if (ForcedDrawToSoftwareDevice() || !context3d()) {
46 base::MessageLoop::current()->PostTask(
47 FROM_HERE, base::Bind(&OutputSurfaceClient::OnSwapBuffersComplete,
48 base::Unretained(client_)));
49 } else {
50 OutputSurface::SwapBuffers(latency_info);
51 }
52 }
53
44 void FakeOutputSurface::SetNeedsBeginFrame(bool enable) { 54 void FakeOutputSurface::SetNeedsBeginFrame(bool enable) {
45 needs_begin_frame_ = enable; 55 needs_begin_frame_ = enable;
46 } 56 }
47 57
48 void FakeOutputSurface::BeginFrame(base::TimeTicks frame_time) { 58 void FakeOutputSurface::BeginFrame(base::TimeTicks frame_time) {
49 client_->BeginFrame(frame_time); 59 client_->BeginFrame(frame_time);
50 } 60 }
51 61
52 bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const { 62 bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const {
53 return forced_draw_to_software_device_; 63 return forced_draw_to_software_device_;
54 } 64 }
55 65
56 void FakeOutputSurface::SendFrameAck() { 66 void FakeOutputSurface::SendFrameAck() {
57 CompositorFrameAck ack; 67 CompositorFrameAck ack;
58 client_->OnSendFrameToParentCompositorAck(ack); 68 client_->OnSendFrameToParentCompositorAck(ack);
59 } 69 }
60 70
61 } // namespace cc 71 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | content/browser/android/in_process/synchronous_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698