From c0aa11d81e409c61455ea231592c236e24bbb57c Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 7 Oct 2016 14:07:09 -0700 Subject: [PATCH] Update //lib/ftl (flutter/engine#3108) This fixes this Fuchsia build, which uses the latest //lib/ftl. --- DEPS | 2 +- engine/src/flutter/glue/task_runner_adaptor.cc | 4 ++++ engine/src/flutter/glue/task_runner_adaptor.h | 1 + engine/src/flutter/lib/ui/window/platform_message.cc | 6 +++--- engine/src/flutter/shell/common/platform_view.cc | 8 ++++---- .../shell/platform/android/platform_view_android.cc | 4 ++-- .../darwin/ios/framework/Source/FlutterViewController.mm | 4 ++-- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/DEPS b/DEPS index 7fb549a24e..73da0f74ba 100644 --- a/DEPS +++ b/DEPS @@ -54,7 +54,7 @@ deps = { # and not have to specific specific hashes. 'src/lib/ftl': - Var('fuchsia_git') + '/ftl' + '@' + '0bb3a02301c8a88b494e58c6636fa509525adaa8', + Var('fuchsia_git') + '/ftl' + '@' + '4917351099cfb11d7bd9a808fd4fce67928c9e40', 'src/lib/tonic': Var('fuchsia_git') + '/tonic' + '@' + '5ca4053563027007ef2e7b2892efe63c26d30259', diff --git a/engine/src/flutter/glue/task_runner_adaptor.cc b/engine/src/flutter/glue/task_runner_adaptor.cc index 8079aa4693..768345ab6f 100644 --- a/engine/src/flutter/glue/task_runner_adaptor.cc +++ b/engine/src/flutter/glue/task_runner_adaptor.cc @@ -37,4 +37,8 @@ void TaskRunnerAdaptor::PostDelayedTask(ftl::Closure task, base::TimeDelta::FromMicroseconds(delay.ToMicroseconds())); } +bool TaskRunnerAdaptor::RunsTasksOnCurrentThread() { + return runner_->RunsTasksOnCurrentThread(); +} + } // namespace glue diff --git a/engine/src/flutter/glue/task_runner_adaptor.h b/engine/src/flutter/glue/task_runner_adaptor.h index 2292527525..8bced363ce 100644 --- a/engine/src/flutter/glue/task_runner_adaptor.h +++ b/engine/src/flutter/glue/task_runner_adaptor.h @@ -20,6 +20,7 @@ class TaskRunnerAdaptor : public ftl::TaskRunner { void PostTask(ftl::Closure task) override; void PostDelayedTask(ftl::Closure task, ftl::TimeDelta delay) override; + bool RunsTasksOnCurrentThread() override; protected: ~TaskRunnerAdaptor() override; diff --git a/engine/src/flutter/lib/ui/window/platform_message.cc b/engine/src/flutter/lib/ui/window/platform_message.cc index 49522930c8..f4f6a3717b 100644 --- a/engine/src/flutter/lib/ui/window/platform_message.cc +++ b/engine/src/flutter/lib/ui/window/platform_message.cc @@ -7,7 +7,7 @@ #include #include "flutter/common/threads.h" -#include "lib/ftl/functional/wrap_lambda.h" +#include "lib/ftl/functional/make_copyable.h" #include "lib/tonic/dart_state.h" #include "lib/tonic/logging/dart_invoke.h" @@ -23,7 +23,7 @@ PlatformMessage::PlatformMessage(std::string name, PlatformMessage::~PlatformMessage() { if (!callback_.is_empty()) { Threads::UI()->PostTask( - ftl::WrapLambda([callback = std::move(callback_)]() mutable { + ftl::MakeCopyable([callback = std::move(callback_)]() mutable { callback.Clear(); })); } @@ -32,7 +32,7 @@ PlatformMessage::~PlatformMessage() { void PlatformMessage::InvokeCallback(std::vector data) { if (callback_.is_empty()) return; - Threads::UI()->PostTask(ftl::WrapLambda( + Threads::UI()->PostTask(ftl::MakeCopyable( [ callback = std::move(callback_), data = std::move(data) ]() mutable { tonic::DartState* dart_state = callback.dart_state().get(); if (!dart_state) diff --git a/engine/src/flutter/shell/common/platform_view.cc b/engine/src/flutter/shell/common/platform_view.cc index b43ed814d3..9a39b0d8f6 100644 --- a/engine/src/flutter/shell/common/platform_view.cc +++ b/engine/src/flutter/shell/common/platform_view.cc @@ -9,7 +9,7 @@ #include "flutter/common/threads.h" #include "flutter/lib/ui/painting/resource_context.h" #include "flutter/shell/common/rasterizer.h" -#include "lib/ftl/functional/wrap_lambda.h" +#include "lib/ftl/functional/make_copyable.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" namespace shell { @@ -32,7 +32,7 @@ PlatformView::~PlatformView() { void PlatformView::ConnectToEngine( mojo::InterfaceRequest request) { - blink::Threads::UI()->PostTask(ftl::WrapLambda([ + blink::Threads::UI()->PostTask(ftl::MakeCopyable([ view = GetWeakViewPtr(), engine = engine().GetWeakPtr(), request = std::move(request) ]() mutable { @@ -50,13 +50,13 @@ void PlatformView::NotifyCreated(std::unique_ptr surface, ftl::Closure caller_continuation) { ftl::AutoResetWaitableEvent latch; - auto ui_continuation = ftl::WrapLambda([ + auto ui_continuation = ftl::MakeCopyable([ this, // surface = std::move(surface), // caller_continuation, // &latch ]() mutable { - auto gpu_continuation = ftl::WrapLambda([ + auto gpu_continuation = ftl::MakeCopyable([ this, // surface = std::move(surface), // caller_continuation, // diff --git a/engine/src/flutter/shell/platform/android/platform_view_android.cc b/engine/src/flutter/shell/platform/android/platform_view_android.cc index 2d996b574b..4edc27cc05 100644 --- a/engine/src/flutter/shell/platform/android/platform_view_android.cc +++ b/engine/src/flutter/shell/platform/android/platform_view_android.cc @@ -23,7 +23,7 @@ #include "flutter/shell/common/shell.h" #include "flutter/shell/gpu/gpu_rasterizer.h" #include "jni/FlutterView_jni.h" -#include "lib/ftl/functional/wrap_lambda.h" +#include "lib/ftl/functional/make_copyable.h" #include "third_party/skia/include/core/SkSurface.h" namespace shell { @@ -100,7 +100,7 @@ void PlatformViewAndroid::DispatchPointerDataPacket(JNIEnv* env, jint position) { char* data = static_cast(env->GetDirectBufferAddress(buffer)); - blink::Threads::UI()->PostTask(ftl::WrapLambda([ + blink::Threads::UI()->PostTask(ftl::MakeCopyable([ engine = engine_->GetWeakPtr(), packet = std::make_unique(data, position) ] { diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 4299f51d56..a863e640f4 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -17,7 +17,7 @@ #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h" #include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h" #include "flutter/shell/platform/darwin/ios/platform_view_ios.h" -#include "lib/ftl/functional/wrap_lambda.h" +#include "lib/ftl/functional/make_copyable.h" #include "lib/ftl/time/time_delta.h" @interface FlutterViewController () @@ -268,7 +268,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase( packet->SetPointerData(i++, pointer_data); } - blink::Threads::UI()->PostTask(ftl::WrapLambda([ + blink::Threads::UI()->PostTask(ftl::MakeCopyable([ engine = _platformView->engine().GetWeakPtr(), packet = std::move(packet) ] { if (engine.get())