Skip to content

Commit 029cfdd

Browse files
authored
[engine] Sync Flutter 3.19.3 source code (#57)
1 parent 97d791a commit 029cfdd

File tree

9 files changed

+280
-27
lines changed

9 files changed

+280
-27
lines changed

.github/workflows/analyze.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
format:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
with:
1111
path: src
1212

.github/workflows/build-docker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
testbed:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: docker/login-action@v2
9+
- uses: docker/login-action@v3
1010
with:
1111
registry: ghcr.io
1212
username: ${{ github.repository_owner }}

.github/workflows/build.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
triple: i686-linux-gnu
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
with:
2424
path: src
2525

26-
- uses: actions/cache@v3
26+
- uses: actions/cache@v4
2727
with:
2828
path: src/sysroot*
2929
key: sysroot-${{ matrix.api-version }}
@@ -67,26 +67,26 @@ jobs:
6767
--target-dir build
6868
ninja -C src/out/build
6969
70-
- uses: actions/upload-artifact@v3
70+
- uses: actions/upload-artifact@v4
7171
with:
7272
name: tizen-${{ matrix.api-version }}-${{ matrix.arch }}
7373
path: src/out/build/libflutter_tizen*.so
7474
if-no-files-found: error
7575

76-
- uses: actions/upload-artifact@v3
76+
- uses: actions/upload-artifact@v4
7777
with:
7878
name: tizen-${{ matrix.api-version }}-${{ matrix.arch }}_unittests
7979
path: src/out/build/flutter_tizen_unittests
8080
if-no-files-found: error
8181

82-
- uses: actions/upload-artifact@v3
82+
- uses: actions/upload-artifact@v4
8383
if: ${{ github.event_name == 'push' }}
8484
with:
8585
name: tizen-${{ matrix.api-version }}-${{ matrix.arch }}_symbols
8686
path: src/out/build/so.unstripped/libflutter_tizen*.so
8787
if-no-files-found: error
8888

89-
- uses: actions/upload-artifact@v3
89+
- uses: actions/upload-artifact@v4
9090
if: ${{ matrix.arch == 'arm' && matrix.api-version == 5.5 }}
9191
with:
9292
name: tizen-common
@@ -101,19 +101,19 @@ jobs:
101101
runs-on: ubuntu-latest
102102

103103
steps:
104-
- uses: actions/checkout@v3
104+
- uses: actions/checkout@v4
105105

106-
- uses: docker/setup-qemu-action@v2
106+
- uses: docker/setup-qemu-action@v3
107107
with:
108108
platforms: arm
109109

110-
- uses: docker/login-action@v2
110+
- uses: docker/login-action@v3
111111
with:
112112
registry: ghcr.io
113113
username: ${{ github.repository_owner }}
114114
password: ${{ secrets.GITHUB_TOKEN }}
115115

116-
- uses: actions/download-artifact@v3
116+
- uses: actions/download-artifact@v4
117117
with:
118118
name: tizen-5.5-arm_unittests
119119

@@ -134,9 +134,9 @@ jobs:
134134
runs-on: ubuntu-latest
135135

136136
steps:
137-
- uses: actions/checkout@v3
137+
- uses: actions/checkout@v4
138138

139-
- uses: actions/download-artifact@v3
139+
- uses: actions/download-artifact@v4
140140

141141
- name: Create archives
142142
run: |
@@ -148,7 +148,7 @@ jobs:
148148
- name: Set variable
149149
run: echo "SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
150150

151-
- uses: softprops/action-gh-release@v1
151+
- uses: softprops/action-gh-release@v2
152152
with:
153153
name: tizen-embedder-${{ env.SHORT_SHA }}
154154
tag_name: ${{ env.SHORT_SHA }}

.github/workflows/check-symbols.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
17-
18-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1917
with:
2018
repository: flutter-tizen/tizen_allowlist
2119
token: ${{ secrets.TIZENAPI_TOKEN }}

flutter/shell/platform/common/client_wrapper/core_implementations.cc

+42
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "binary_messenger_impl.h"
2121
#include "include/flutter/engine_method_result.h"
22+
#include "include/flutter/method_channel.h"
23+
#include "include/flutter/standard_method_codec.h"
2224
#include "texture_registrar_impl.h"
2325

2426
namespace flutter {
@@ -164,6 +166,46 @@ void ReplyManager::SendResponseData(const std::vector<uint8_t>* data) {
164166

165167
} // namespace internal
166168

169+
// ========== method_channel.h ==========
170+
171+
namespace {
172+
173+
constexpr char kControlChannelName[] = "dev.flutter/channel-buffers";
174+
constexpr char kResizeMethod[] = "resize";
175+
constexpr char kOverflowMethod[] = "overflow";
176+
177+
} // namespace
178+
179+
namespace internal {
180+
181+
void ResizeChannel(BinaryMessenger* messenger, std::string name, int new_size) {
182+
auto control_channel = std::make_unique<MethodChannel<EncodableValue>>(
183+
messenger, kControlChannelName, &StandardMethodCodec::GetInstance());
184+
185+
// The deserialization logic handles only 32 bits values, see
186+
// https://github.com/flutter/engine/blob/93e8901490e78c7ba7e319cce4470d9c6478c6dc/lib/ui/channel_buffers.dart#L495.
187+
control_channel->InvokeMethod(
188+
kResizeMethod, std::make_unique<EncodableValue>(EncodableList{
189+
EncodableValue(name),
190+
EncodableValue(static_cast<int32_t>(new_size)),
191+
}));
192+
}
193+
194+
void SetChannelWarnsOnOverflow(BinaryMessenger* messenger,
195+
std::string name,
196+
bool warns) {
197+
auto control_channel = std::make_unique<MethodChannel<EncodableValue>>(
198+
messenger, kControlChannelName, &StandardMethodCodec::GetInstance());
199+
200+
control_channel->InvokeMethod(kOverflowMethod,
201+
std::make_unique<EncodableValue>(EncodableList{
202+
EncodableValue(name),
203+
EncodableValue(!warns),
204+
}));
205+
}
206+
207+
} // namespace internal
208+
167209
// ========== texture_registrar_impl.h ==========
168210

169211
TextureRegistrarImpl::TextureRegistrarImpl(

flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h

+37
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@
1313

1414
namespace flutter {
1515

16+
namespace internal {
17+
// Internal helper functions used by BasicMessageChannel and MethodChannel.
18+
19+
// Adjusts the number of messages that will get buffered when sending messages
20+
// to channels that aren't fully set up yet. For example, the engine isn't
21+
// running yet or the channel's message handler isn't set up on the Dart side
22+
// yet.
23+
void ResizeChannel(BinaryMessenger* messenger, std::string name, int new_size);
24+
25+
// Defines whether the channel should show warning messages when discarding
26+
// messages due to overflow.
27+
//
28+
// When |warns| is false, the channel is expected to overflow and warning
29+
// messages will not be shown.
30+
void SetChannelWarnsOnOverflow(BinaryMessenger* messenger,
31+
std::string name,
32+
bool warns);
33+
34+
} // namespace internal
35+
1636
class EncodableValue;
1737

1838
// A message reply callback.
@@ -99,6 +119,23 @@ class BasicMessageChannel {
99119
messenger_->SetMessageHandler(name_, std::move(binary_handler));
100120
}
101121

122+
// Adjusts the number of messages that will get buffered when sending messages
123+
// to channels that aren't fully set up yet. For example, the engine isn't
124+
// running yet or the channel's message handler isn't set up on the Dart side
125+
// yet.
126+
void Resize(int new_size) {
127+
internal::ResizeChannel(messenger_, name_, new_size);
128+
}
129+
130+
// Defines whether the channel should show warning messages when discarding
131+
// messages due to overflow.
132+
//
133+
// When |warns| is false, the channel is expected to overflow and warning
134+
// messages will not be shown.
135+
void SetWarnsOnOverflow(bool warns) {
136+
internal::SetChannelWarnsOnOverflow(messenger_, name_, warns);
137+
}
138+
102139
private:
103140
BinaryMessenger* messenger_;
104141
std::string name_;

flutter/shell/platform/common/client_wrapper/include/flutter/method_call.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
6-
#define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
5+
#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CALL_H_
6+
#define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CALL_H_
77

88
#include <memory>
99
#include <string>
@@ -40,4 +40,4 @@ class MethodCall {
4040

4141
} // namespace flutter
4242

43-
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
43+
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CALL_H_

flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h

+18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <iostream>
99
#include <string>
1010

11+
#include "basic_message_channel.h"
1112
#include "binary_messenger.h"
1213
#include "engine_method_result.h"
1314
#include "method_call.h"
@@ -122,6 +123,23 @@ class MethodChannel {
122123
messenger_->SetMessageHandler(name_, std::move(binary_handler));
123124
}
124125

126+
// Adjusts the number of messages that will get buffered when sending messages
127+
// to channels that aren't fully set up yet. For example, the engine isn't
128+
// running yet or the channel's message handler isn't set up on the Dart side
129+
// yet.
130+
void Resize(int new_size) {
131+
internal::ResizeChannel(messenger_, name_, new_size);
132+
}
133+
134+
// Defines whether the channel should show warning messages when discarding
135+
// messages due to overflow.
136+
//
137+
// When |warns| is false, the channel is expected to overflow and warning
138+
// messages will not be shown.
139+
void SetWarnsOnOverflow(bool warns) {
140+
internal::SetChannelWarnsOnOverflow(messenger_, name_, warns);
141+
}
142+
125143
private:
126144
BinaryMessenger* messenger_;
127145
std::string name_;

0 commit comments

Comments
 (0)