Index: cc/test/fake_output_surface.cc |
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc |
index d393ba0c44f17ded1f7145dc1671eb0ad87fb100..c3f3e1a83cd73a4ba320cdac0bf3bd7434af2b56 100644 |
--- a/cc/test/fake_output_surface.cc |
+++ b/cc/test/fake_output_surface.cc |
@@ -12,44 +12,55 @@ |
namespace cc { |
FakeOutputSurface::FakeOutputSurface( |
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) |
+ scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
+ bool delegated_rendering) |
: OutputSurface(context3d.Pass()), |
num_sent_frames_(0), |
needs_begin_frame_(false), |
- forced_draw_to_software_device_(false), |
- weak_ptr_factory_(this) { |
- capabilities_.has_parent_compositor = has_parent; |
+ forced_draw_to_software_device_(false) { |
+ if (delegated_rendering) { |
+ capabilities_.delegated_rendering = true; |
+ capabilities_.max_frames_pending = 1; |
+ } |
} |
FakeOutputSurface::FakeOutputSurface( |
- scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) |
+ scoped_ptr<SoftwareOutputDevice> software_device, bool delegated_rendering) |
: OutputSurface(software_device.Pass()), |
num_sent_frames_(0), |
- forced_draw_to_software_device_(false), |
- weak_ptr_factory_(this) { |
- capabilities_.has_parent_compositor = has_parent; |
+ forced_draw_to_software_device_(false) { |
+ if (delegated_rendering) { |
+ capabilities_.delegated_rendering = true; |
+ capabilities_.max_frames_pending = 1; |
+ } |
} |
FakeOutputSurface::FakeOutputSurface( |
scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
scoped_ptr<SoftwareOutputDevice> software_device, |
- bool has_parent) |
+ bool delegated_rendering) |
: OutputSurface(context3d.Pass(), software_device.Pass()), |
num_sent_frames_(0), |
- forced_draw_to_software_device_(false), |
- weak_ptr_factory_(this) { |
- capabilities_.has_parent_compositor = has_parent; |
+ forced_draw_to_software_device_(false) { |
+ if (delegated_rendering) { |
+ capabilities_.delegated_rendering = true; |
+ capabilities_.max_frames_pending = 1; |
+ } |
} |
FakeOutputSurface::~FakeOutputSurface() {} |
-void FakeOutputSurface::SendFrameToParentCompositor( |
- CompositorFrame* frame) { |
- frame->AssignTo(&last_sent_frame_); |
- ++num_sent_frames_; |
- base::MessageLoop::current()->PostTask( |
- FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck, |
- weak_ptr_factory_.GetWeakPtr())); |
+void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { |
+ if (frame->software_frame_data || frame->delegated_frame_data || |
+ !context3d()) { |
+ frame->AssignTo(&last_sent_frame_); |
+ ++num_sent_frames_; |
+ PostSwapBuffersComplete(); |
+ } else { |
+ OutputSurface::SwapBuffers(frame); |
+ frame->AssignTo(&last_sent_frame_); |
+ ++num_sent_frames_; |
+ } |
} |
void FakeOutputSurface::SetNeedsBeginFrame(bool enable) { |
@@ -64,9 +75,4 @@ bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const { |
return forced_draw_to_software_device_; |
} |
-void FakeOutputSurface::SendFrameAck() { |
- CompositorFrameAck ack; |
- client_->OnSendFrameToParentCompositorAck(ack); |
-} |
- |
} // namespace cc |