| 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 namespace flutter {
8
9 PlatformMessageResponseDarwin::PlatformMessageResponseDarwin(
10 PlatformMessageResponseCallback callback,
11 fml::RefPtr<fml::TaskRunner> platform_task_runner)
12 : callback_(callback, fml::scoped_policy::OwnershipPolicy::kRetain),
13 platform_task_runner_(std::move(platform_task_runner)) {}
14
15 PlatformMessageResponseDarwin::~PlatformMessageResponseDarwin() = default;
16
17 void PlatformMessageResponseDarwin::Complete(std::unique_ptr<fml::Mapping> data) {
18 fml::RefPtr<PlatformMessageResponseDarwin> self(this);
19 platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable {
20 self->callback_.get()(CopyMappingPtrToNSData(std::move(data)));
21 }));
22 }
23
24 void PlatformMessageResponseDarwin::CompleteEmpty() {
25 fml::RefPtr<PlatformMessageResponseDarwin> self(this);
26 platform_task_runner_->PostTask(
27 fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); }));
28 }
29
30 } // namespace flutter
flutter::PlatformMessageResponseDarwin::CompleteEmpty
void CompleteEmpty() override
Definition: platform_message_response_darwin.mm:24
flutter::PlatformMessageResponseDarwin::Complete
void Complete(std::unique_ptr< fml::Mapping > data) override
Definition: platform_message_response_darwin.mm:17
PlatformMessageResponseCallback
void(^ PlatformMessageResponseCallback)(NSData *)
Definition: platform_message_response_darwin.h:17
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