Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1e7382b

Browse files
committed
Migrate PlatformMessageHandlerIos to ARC
1 parent 96898c4 commit 1e7382b

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed

shell/platform/darwin/ios/BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ source_set("flutter_framework_source_arc") {
117117
"ios_surface_metal_skia.mm",
118118
"ios_surface_software.h",
119119
"ios_surface_software.mm",
120+
"platform_message_handler_ios.h",
121+
"platform_message_handler_ios.mm",
120122
"rendering_api_selection.h",
121123
"rendering_api_selection.mm",
122124
]
@@ -180,8 +182,6 @@ source_set("flutter_framework_source") {
180182
"framework/Source/accessibility_text_entry.mm",
181183
"ios_external_view_embedder.h",
182184
"ios_external_view_embedder.mm",
183-
"platform_message_handler_ios.h",
184-
"platform_message_handler_ios.mm",
185185
"platform_view_ios.h",
186186
"platform_view_ios.mm",
187187
]

shell/platform/darwin/ios/platform_message_handler_ios.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_MESSAGE_HANDLER_IOS_H_
66
#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_MESSAGE_HANDLER_IOS_H_
77

8-
#include <unordered_map>
9-
10-
#include "flutter/common/task_runners.h"
118
#include "flutter/fml/platform/darwin/scoped_block.h"
12-
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
9+
#include "flutter/fml/task_runner.h"
1310
#include "flutter/shell/common/platform_message_handler.h"
14-
#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterBinaryMessenger.h"
1511
#import "flutter/shell/platform/darwin/ios/flutter_task_queue_dispatch.h"
1612

1713
namespace flutter {
@@ -36,7 +32,7 @@ class PlatformMessageHandlerIos : public PlatformMessageHandler {
3632
NSObject<FlutterTaskQueue>* task_queue);
3733

3834
struct HandlerInfo {
39-
fml::scoped_nsprotocol<NSObject<FlutterTaskQueueDispatch>*> task_queue;
35+
NSObject<FlutterTaskQueueDispatch>* task_queue;
4036
fml::ScopedBlock<FlutterBinaryMessageHandler> handler;
4137
};
4238

shell/platform/darwin/ios/platform_message_handler_ios.mm

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
#import "flutter/shell/platform/darwin/ios/platform_message_handler_ios.h"
66

7-
#import "flutter/fml/trace_event.h"
8-
#import "flutter/lib/ui/window/platform_message.h"
9-
#import "flutter/shell/platform/darwin/common/buffer_conversions.h"
10-
#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterBinaryMessenger.h"
7+
#include "flutter/fml/trace_event.h"
8+
#include "flutter/lib/ui/window/platform_message.h"
9+
#include "flutter/lib/ui/window/platform_message_response.h"
10+
#include "flutter/shell/platform/darwin/common/buffer_conversions.h"
11+
12+
FLUTTER_ASSERT_ARC
1113

1214
static uint64_t platform_message_counter = 1;
1315

@@ -24,11 +26,6 @@ - (instancetype)init {
2426
return self;
2527
}
2628

27-
- (void)dealloc {
28-
dispatch_release(_queue);
29-
[super dealloc];
30-
}
31-
3229
- (void)dispatch:(dispatch_block_t)block {
3330
dispatch_async(self.queue, block);
3431
}
@@ -37,7 +34,7 @@ - (void)dispatch:(dispatch_block_t)block {
3734
namespace flutter {
3835

3936
NSObject<FlutterTaskQueue>* PlatformMessageHandlerIos::MakeBackgroundTaskQueue() {
40-
return [[[FLTSerialTaskQueue alloc] init] autorelease];
37+
return [[FLTSerialTaskQueue alloc] init];
4138
}
4239

4340
PlatformMessageHandlerIos::PlatformMessageHandlerIos(
@@ -83,8 +80,8 @@ - (void)dispatch:(dispatch_block_t)block {
8380
});
8481
};
8582

86-
if (handler_info.task_queue.get()) {
87-
[handler_info.task_queue.get() dispatch:run_handler];
83+
if (handler_info.task_queue) {
84+
[handler_info.task_queue dispatch:run_handler];
8885
} else {
8986
dispatch_async(dispatch_get_main_queue(), run_handler);
9087
}
@@ -127,8 +124,7 @@ - (void)dispatch:(dispatch_block_t)block {
127124
message_handlers_.erase(channel);
128125
if (handler) {
129126
message_handlers_[channel] = {
130-
.task_queue = fml::scoped_nsprotocol(
131-
[static_cast<NSObject<FlutterTaskQueueDispatch>*>(task_queue) retain]),
127+
.task_queue = (NSObject<FlutterTaskQueueDispatch>*)task_queue,
132128
.handler =
133129
fml::ScopedBlock<FlutterBinaryMessageHandler>{
134130
handler, fml::scoped_policy::OwnershipPolicy::kRetain},

0 commit comments

Comments
 (0)