Flutter Engine
The Flutter Engine
platform_message_response_darwin.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#import "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h"
6
7#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
8
10
11namespace flutter {
12
13PlatformMessageResponseDarwin::PlatformMessageResponseDarwin(
15 fml::RefPtr<fml::TaskRunner> platform_task_runner)
16 : callback_(callback, fml::scoped_policy::OwnershipPolicy::kRetain),
17 platform_task_runner_(std::move(platform_task_runner)) {}
18
19PlatformMessageResponseDarwin::~PlatformMessageResponseDarwin() = default;
20
21void PlatformMessageResponseDarwin::Complete(std::unique_ptr<fml::Mapping> data) {
23 platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable {
24 self->callback_.get()(CopyMappingPtrToNSData(std::move(data)));
25 }));
26}
27
28void PlatformMessageResponseDarwin::CompleteEmpty() {
30 platform_task_runner_->PostTask(
31 fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); }));
32}
33
34} // namespace flutter
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
NSData * CopyMappingPtrToNSData(std::unique_ptr< fml::Mapping > mapping)
Definition: ascii_trie.cc:9
internal::CopyableLambda< T > MakeCopyable(T lambda)
Definition: make_copyable.h:57
Definition: ref_ptr.h:256
void(^ PlatformMessageResponseCallback)(NSData *)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63