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

Unified Diff: cc/test/fake_output_surface.cc

Issue 2402173002: cc: Get rid of PostSwapBuffersComplete. (Closed)
Patch Set: postswap: . Created 4 years, 2 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
Index: cc/test/fake_output_surface.cc
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc
index 7d5a296b32e4d26de065c3d1320f6fd454212b6b..c052994b875a9fd1e83e307e071a7353adbe4058 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -5,7 +5,7 @@
#include "cc/test/fake_output_surface.h"
#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "cc/output/output_surface_client.h"
#include "cc/resources/returned_resource.h"
#include "cc/test/begin_frame_args_test.h"
@@ -15,11 +15,11 @@ namespace cc {
FakeOutputSurface::FakeOutputSurface(
scoped_refptr<ContextProvider> context_provider)
- : OutputSurface(std::move(context_provider)) {}
+ : OutputSurface(std::move(context_provider)), weak_ptr_factory_(this) {}
FakeOutputSurface::FakeOutputSurface(
std::unique_ptr<SoftwareOutputDevice> software_device)
- : OutputSurface(std::move(software_device)) {}
+ : OutputSurface(std::move(software_device)), weak_ptr_factory_(this) {}
FakeOutputSurface::~FakeOutputSurface() = default;
@@ -36,7 +36,13 @@ void FakeOutputSurface::SwapBuffers(OutputSurfaceFrame frame) {
last_swap_rect_valid_ = false;
}
- PostSwapBuffersComplete();
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&FakeOutputSurface::SwapBuffersCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void FakeOutputSurface::SwapBuffersCallback() {
+ client_->DidSwapBuffersComplete();
}
void FakeOutputSurface::BindFramebuffer() {

Powered by Google App Engine
This is Rietveld 408576698