Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
platform_message_handler_ios.h
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#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_MESSAGE_HANDLER_IOS_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_MESSAGE_HANDLER_IOS_H_
7
8#include <unordered_map>
9
10#include "flutter/common/task_runners.h"
11#include "flutter/fml/platform/darwin/scoped_block.h"
12#include "flutter/fml/platform/darwin/scoped_nsobject.h"
13#include "flutter/shell/common/platform_message_handler.h"
14#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterBinaryMessenger.h"
15#import "flutter/shell/platform/darwin/ios/flutter_task_queue_dispatch.h"
16
17namespace flutter {
18
20 public:
21 static NSObject<FlutterTaskQueue>* MakeBackgroundTaskQueue();
22
23 explicit PlatformMessageHandlerIos(fml::RefPtr<fml::TaskRunner> platform_task_runner);
24
25 void HandlePlatformMessage(std::unique_ptr<PlatformMessage> message) override;
26
28
29 void InvokePlatformMessageResponseCallback(int response_id,
30 std::unique_ptr<fml::Mapping> mapping) override;
31
32 void InvokePlatformMessageEmptyResponseCallback(int response_id) override;
33
34 void SetMessageHandler(const std::string& channel,
36 NSObject<FlutterTaskQueue>* task_queue);
37
42
43 private:
44 std::unordered_map<std::string, HandlerInfo> message_handlers_;
45 const fml::RefPtr<fml::TaskRunner> platform_task_runner_;
46 std::mutex message_handlers_mutex_;
48};
49
50} // namespace flutter
51
52#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_MESSAGE_HANDLER_IOS_H_
void(^ FlutterBinaryMessageHandler)(NSData *_Nullable message, FlutterBinaryReply reply)
void HandlePlatformMessage(std::unique_ptr< PlatformMessage > message) override
bool DoesHandlePlatformMessageOnPlatformThread() const override
void InvokePlatformMessageEmptyResponseCallback(int response_id) override
void SetMessageHandler(const std::string &channel, FlutterBinaryMessageHandler handler, NSObject< FlutterTaskQueue > *task_queue)
static NSObject< FlutterTaskQueue > * MakeBackgroundTaskQueue()
void InvokePlatformMessageResponseCallback(int response_id, std::unique_ptr< fml::Mapping > mapping) override
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
Win32Message message
fml::ScopedBlock< FlutterBinaryMessageHandler > handler
fml::scoped_nsprotocol< NSObject< FlutterTaskQueueDispatch > * > task_queue