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

Unified Diff: cc/test/pixel_test_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/pixel_test_output_surface.cc
diff --git a/cc/test/pixel_test_output_surface.cc b/cc/test/pixel_test_output_surface.cc
index 93cc427664d879b875ebaee8ced73ee651287f59..ea46bb3b96ecc5fcc4efc8a87490de5d6bc20f9b 100644
--- a/cc/test/pixel_test_output_surface.cc
+++ b/cc/test/pixel_test_output_surface.cc
@@ -6,6 +6,8 @@
#include <utility>
+#include "base/bind.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "cc/output/output_surface_client.h"
#include "cc/output/output_surface_frame.h"
#include "gpu/command_buffer/client/gles2_interface.h"
@@ -17,15 +19,13 @@ namespace cc {
PixelTestOutputSurface::PixelTestOutputSurface(
scoped_refptr<ContextProvider> context_provider,
bool flipped_output_surface)
- : OutputSurface(std::move(context_provider)),
- external_stencil_test_(false) {
+ : OutputSurface(std::move(context_provider)), weak_ptr_factory_(this) {
capabilities_.flipped_output_surface = flipped_output_surface;
}
PixelTestOutputSurface::PixelTestOutputSurface(
std::unique_ptr<SoftwareOutputDevice> software_device)
- : OutputSurface(std::move(software_device)),
- external_stencil_test_(false) {}
+ : OutputSurface(std::move(software_device)), weak_ptr_factory_(this) {}
PixelTestOutputSurface::~PixelTestOutputSurface() = default;
@@ -53,7 +53,13 @@ bool PixelTestOutputSurface::HasExternalStencilTest() const {
void PixelTestOutputSurface::ApplyExternalStencil() {}
void PixelTestOutputSurface::SwapBuffers(OutputSurfaceFrame frame) {
- PostSwapBuffersComplete();
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&PixelTestOutputSurface::SwapBuffersCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void PixelTestOutputSurface::SwapBuffersCallback() {
+ client_->DidSwapBuffersComplete();
}
OverlayCandidateValidator*

Powered by Google App Engine
This is Rietveld 408576698