From 18bfdff87eb9e9b37db9919bf7589d0467982eb1 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 18 Apr 2017 16:26:37 -0700 Subject: [PATCH] Fix Android Vulkan build. (flutter/engine#3606) --- .../flutter/shell/gpu/gpu_surface_vulkan.cc | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc b/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc index 9b1932f6e4..8406714fe3 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc +++ b/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc @@ -32,18 +32,21 @@ std::unique_ptr GPUSurfaceVulkan::AcquireFrame( return nullptr; } - return std::make_unique( - std::move(surface), - [weak_this = weak_factory_.GetWeakPtr()](SkCanvas * canvas)->bool { - // Frames are only ever acquired on the GPU thread. This is also the - // thread on which the weak pointer factory is collected (as this - // instance is owned by the rasterizer). So this use of weak pointers is - // safe. - if (canvas == nullptr || !weak_this) { - return false; - } - return weak_this->window_.SwapBuffers(); - }); + SurfaceFrame::SubmitCallback callback = [weak_this = + weak_factory_.GetWeakPtr()]( + const SurfaceFrame&, + SkCanvas* canvas) + ->bool { + // Frames are only ever acquired on the GPU thread. This is also the thread + // on which the weak pointer factory is collected (as this instance is owned + // by the rasterizer). So this use of weak pointers is safe. + if (canvas == nullptr || !weak_this) { + return false; + } + return weak_this->window_.SwapBuffers(); + }; + return std::make_unique(std::move(surface), + std::move(callback)); } GrContext* GPUSurfaceVulkan::GetContext() {