| Flutter iOS Embedder |

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
9 FLUTTER_ASSERT_ARC
10
11 namespace flutter {
12
13 PlatformMessageResponseDarwin::PlatformMessageResponseDarwin(
14 PlatformMessageResponseCallback callback,
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
19 PlatformMessageResponseDarwin::~PlatformMessageResponseDarwin() = default;
20
21 void PlatformMessageResponseDarwin::Complete(std::unique_ptr<fml::Mapping> data) {
22 fml::RefPtr<PlatformMessageResponseDarwin> self(this);
23 platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable {
24 self->callback_.get()(CopyMappingPtrToNSData(std::move(data)));
25 }));
26 }
27
28 void PlatformMessageResponseDarwin::CompleteEmpty() {
29 fml::RefPtr<PlatformMessageResponseDarwin> self(this);
30 platform_task_runner_->PostTask(
31 fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); }));
32 }
33
34 } // namespace flutter
flutter::PlatformMessageResponseDarwin::CompleteEmpty
void CompleteEmpty() override
Definition: platform_message_response_darwin.mm:28
flutter::PlatformMessageResponseDarwin::Complete
void Complete(std::unique_ptr< fml::Mapping > data) override
Definition: platform_message_response_darwin.mm:21
PlatformMessageResponseCallback
void(^ PlatformMessageResponseCallback)(NSData *)
Definition: platform_message_response_darwin.h:17
FlutterMacros.h
flutter
Definition: accessibility_bridge.h:28
platform_message_response_darwin.h
flutter::CopyMappingPtrToNSData
NSData * CopyMappingPtrToNSData(std::unique_ptr< fml::Mapping > mapping)
Definition: buffer_conversions.mm:44
FLUTTER_ASSERT_ARC
Definition: FlutterChannelKeyResponder.mm:13