#include <platform_message_handler_ios.h>
◆ PlatformMessageHandlerIos()
flutter::PlatformMessageHandlerIos::PlatformMessageHandlerIos |
( |
fml::RefPtr< fml::TaskRunner > |
platform_task_runner | ) |
|
|
explicit |
◆ DoesHandlePlatformMessageOnPlatformThread()
bool flutter::PlatformMessageHandlerIos::DoesHandlePlatformMessageOnPlatformThread |
( |
| ) |
const |
|
override |
◆ HandlePlatformMessage()
void flutter::PlatformMessageHandlerIos::HandlePlatformMessage |
( |
std::unique_ptr< PlatformMessage > |
message | ) |
|
|
override |
Definition at line 44 of file platform_message_handler_ios.mm.
47 fml::RefPtr<flutter::PlatformMessageResponse> completer = message->response();
48 HandlerInfo handler_info;
53 std::lock_guard lock(message_handlers_mutex_);
54 auto it = message_handlers_.find(message->channel());
55 if (it != message_handlers_.end()) {
56 handler_info = it->second;
59 if (handler_info.handler) {
62 if (message->hasData()) {
67 TRACE_EVENT_ASYNC_BEGIN1(
"flutter",
"PlatformChannel ScheduleHandler", platform_message_id,
68 "channel", message->channel().c_str());
69 dispatch_block_t run_handler = ^{
70 handler(data, ^(NSData* reply) {
71 TRACE_EVENT_ASYNC_END0(
"flutter",
"PlatformChannel ScheduleHandler", platform_message_id);
77 completer->CompleteEmpty();
83 if (handler_info.task_queue.get()) {
84 [handler_info.task_queue.get() dispatch:run_handler];
86 dispatch_async(dispatch_get_main_queue(), run_handler);
90 completer->CompleteEmpty();
References flutter::ConvertMappingToNSData(), flutter::ConvertNSDataToMappingPtr(), flutter::PlatformMessageHandlerIos::HandlerInfo::handler, platform_message_counter, and flutter::PlatformMessageHandlerIos::HandlerInfo::task_queue.
◆ InvokePlatformMessageEmptyResponseCallback()
void flutter::PlatformMessageHandlerIos::InvokePlatformMessageEmptyResponseCallback |
( |
int |
response_id | ) |
|
|
override |
◆ InvokePlatformMessageResponseCallback()
void flutter::PlatformMessageHandlerIos::InvokePlatformMessageResponseCallback |
( |
int |
response_id, |
|
|
std::unique_ptr< fml::Mapping > |
mapping |
|
) |
| |
|
override |
◆ MakeBackgroundTaskQueue()
NSObject< FlutterTaskQueue > * flutter::PlatformMessageHandlerIos::MakeBackgroundTaskQueue |
( |
| ) |
|
|
static |
◆ SetMessageHandler()
TODO(gaaclarke): This should be migrated to a lockfree datastructure.
Definition at line 114 of file platform_message_handler_ios.mm.
117 FML_CHECK(platform_task_runner_->RunsTasksOnCurrentThread());
121 FML_CHECK(!task_queue || [task_queue respondsToSelector:
@selector(dispatch:)]);
123 std::lock_guard lock(message_handlers_mutex_);
124 message_handlers_.erase(channel);
126 message_handlers_[channel] = {
128 fml::scoped_nsprotocol(
static_cast<NSObject<FlutterTaskQueueDispatch>*
>(task_queue)),
130 fml::ScopedBlock<FlutterBinaryMessageHandler>{
131 handler, fml::scoped_policy::OwnershipPolicy::kRetain},
The documentation for this class was generated from the following files: