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

Unified Diff: cc/test/test_compositor_frame_sink.cc

Issue 2379343003: Revert of cc: Remove frame queuing from the scheduler. (Closed)
Patch Set: Created 4 years, 3 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/test_compositor_frame_sink.h ('k') | cc/trees/proxy_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/test_compositor_frame_sink.cc
diff --git a/cc/test/test_compositor_frame_sink.cc b/cc/test/test_compositor_frame_sink.cc
index a2a6ac7f6e5b9a004b9997e1cd57a5761e25ad28..35ba8e978350ef9d58009c65e2c87918b519082c 100644
--- a/cc/test/test_compositor_frame_sink.cc
+++ b/cc/test/test_compositor_frame_sink.cc
@@ -32,7 +32,8 @@
std::move(worker_context_provider)),
surface_manager_(new SurfaceManager),
surface_id_allocator_(new SurfaceIdAllocator(kCompositorClientId)),
- surface_factory_(new SurfaceFactory(surface_manager_.get(), this)) {
+ surface_factory_(new SurfaceFactory(surface_manager_.get(), this)),
+ weak_ptrs_(this) {
std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source;
std::unique_ptr<DisplayScheduler> scheduler;
if (!synchronous_composite) {
@@ -114,6 +115,7 @@
surface_factory_ = nullptr;
surface_id_allocator_ = nullptr;
surface_manager_ = nullptr;
+ weak_ptrs_.InvalidateWeakPtrs();
CompositorFrameSink::DetachFromClient();
}
@@ -137,7 +139,7 @@
surface_factory_->SubmitCompositorFrame(
delegated_surface_id_, std::move(frame),
base::Bind(&TestCompositorFrameSink::DidDrawCallback,
- base::Unretained(this)));
+ weak_ptrs_.GetWeakPtr(), synchronous));
for (std::unique_ptr<CopyOutputRequest>& copy_request : copy_requests_)
surface_factory_->RequestCopyOfSurface(delegated_surface_id_,
@@ -148,10 +150,17 @@
display_->DrawAndSwap();
}
-void TestCompositorFrameSink::DidDrawCallback() {
+void TestCompositorFrameSink::DidDrawCallback(bool synchronous) {
// This is the frame ack to unthrottle the next frame, not actually a notice
// that drawing is done.
- CompositorFrameSink::PostSwapBuffersComplete();
+ if (synchronous) {
+ // For synchronous draws, this must be posted to a new stack because we are
+ // still the original call to SwapBuffers, and we want to leave that before
+ // saying that it is done.
+ CompositorFrameSink::PostSwapBuffersComplete();
+ } else {
+ client_->DidSwapBuffersComplete();
+ }
}
void TestCompositorFrameSink::ForceReclaimResources() {
« no previous file with comments | « cc/test/test_compositor_frame_sink.h ('k') | cc/trees/proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698