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

Unified Diff: cc/test/fake_output_surface.cc

Issue 16304003: Unified OutputSurface::SwapBuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to 205473 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698