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

Unified Diff: cc/test/fake_output_surface.cc

Issue 2402173002: cc: Get rid of PostSwapBuffersComplete. (Closed)
Patch Set: postswap: fix-blimp-unittest-post-swap-acks 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
« 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 a096f7f37c7160ec8bff102da25d13d5b8da750b..757c28d3b3abdeb4dbf4192afeda4a686da6deca 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,13 +15,13 @@ namespace cc {
FakeOutputSurface::FakeOutputSurface(
scoped_refptr<ContextProvider> context_provider)
- : OutputSurface(std::move(context_provider)) {
+ : OutputSurface(std::move(context_provider)), weak_ptr_factory_(this) {
DCHECK(OutputSurface::context_provider());
}
FakeOutputSurface::FakeOutputSurface(
std::unique_ptr<SoftwareOutputDevice> software_device)
- : OutputSurface(std::move(software_device)) {
+ : OutputSurface(std::move(software_device)), weak_ptr_factory_(this) {
DCHECK(OutputSurface::software_device());
}
@@ -52,7 +52,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() {
« 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