Skip to content

[engine] Sync Flutter 3.19.3 source code #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
testbed:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
triple: i686-linux-gnu

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: src/sysroot*
key: sysroot-${{ matrix.api-version }}
Expand Down Expand Up @@ -67,26 +67,26 @@ jobs:
--target-dir build
ninja -C src/out/build

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: tizen-${{ matrix.api-version }}-${{ matrix.arch }}
path: src/out/build/libflutter_tizen*.so
if-no-files-found: error

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

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

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

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v2
- uses: docker/setup-qemu-action@v3
with:
platforms: arm

- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: tizen-5.5-arm_unittests

Expand All @@ -134,9 +134,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4

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

- uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v2
with:
name: tizen-embedder-${{ env.SHORT_SHA }}
tag_name: ${{ env.SHORT_SHA }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/check-symbols.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: flutter-tizen/tizen_allowlist
token: ${{ secrets.TIZENAPI_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "binary_messenger_impl.h"
#include "include/flutter/engine_method_result.h"
#include "include/flutter/method_channel.h"
#include "include/flutter/standard_method_codec.h"
#include "texture_registrar_impl.h"

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

} // namespace internal

// ========== method_channel.h ==========

namespace {

constexpr char kControlChannelName[] = "dev.flutter/channel-buffers";
constexpr char kResizeMethod[] = "resize";
constexpr char kOverflowMethod[] = "overflow";

} // namespace

namespace internal {

void ResizeChannel(BinaryMessenger* messenger, std::string name, int new_size) {
auto control_channel = std::make_unique<MethodChannel<EncodableValue>>(
messenger, kControlChannelName, &StandardMethodCodec::GetInstance());

// The deserialization logic handles only 32 bits values, see
// https://github.com/flutter/engine/blob/93e8901490e78c7ba7e319cce4470d9c6478c6dc/lib/ui/channel_buffers.dart#L495.
control_channel->InvokeMethod(
kResizeMethod, std::make_unique<EncodableValue>(EncodableList{
EncodableValue(name),
EncodableValue(static_cast<int32_t>(new_size)),
}));
}

void SetChannelWarnsOnOverflow(BinaryMessenger* messenger,
std::string name,
bool warns) {
auto control_channel = std::make_unique<MethodChannel<EncodableValue>>(
messenger, kControlChannelName, &StandardMethodCodec::GetInstance());

control_channel->InvokeMethod(kOverflowMethod,
std::make_unique<EncodableValue>(EncodableList{
EncodableValue(name),
EncodableValue(!warns),
}));
}

} // namespace internal

// ========== texture_registrar_impl.h ==========

TextureRegistrarImpl::TextureRegistrarImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@

namespace flutter {

namespace internal {
// Internal helper functions used by BasicMessageChannel and MethodChannel.

// Adjusts the number of messages that will get buffered when sending messages
// to channels that aren't fully set up yet. For example, the engine isn't
// running yet or the channel's message handler isn't set up on the Dart side
// yet.
void ResizeChannel(BinaryMessenger* messenger, std::string name, int new_size);

// Defines whether the channel should show warning messages when discarding
// messages due to overflow.
//
// When |warns| is false, the channel is expected to overflow and warning
// messages will not be shown.
void SetChannelWarnsOnOverflow(BinaryMessenger* messenger,
std::string name,
bool warns);

} // namespace internal

class EncodableValue;

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

// Adjusts the number of messages that will get buffered when sending messages
// to channels that aren't fully set up yet. For example, the engine isn't
// running yet or the channel's message handler isn't set up on the Dart side
// yet.
void Resize(int new_size) {
internal::ResizeChannel(messenger_, name_, new_size);
}

// Defines whether the channel should show warning messages when discarding
// messages due to overflow.
//
// When |warns| is false, the channel is expected to overflow and warning
// messages will not be shown.
void SetWarnsOnOverflow(bool warns) {
internal::SetChannelWarnsOnOverflow(messenger_, name_, warns);
}

private:
BinaryMessenger* messenger_;
std::string name_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
#define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CALL_H_
#define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CALL_H_

#include <memory>
#include <string>
Expand Down Expand Up @@ -40,4 +40,4 @@ class MethodCall {

} // namespace flutter

#endif // FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CALL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <iostream>
#include <string>

#include "basic_message_channel.h"
#include "binary_messenger.h"
#include "engine_method_result.h"
#include "method_call.h"
Expand Down Expand Up @@ -122,6 +123,23 @@ class MethodChannel {
messenger_->SetMessageHandler(name_, std::move(binary_handler));
}

// Adjusts the number of messages that will get buffered when sending messages
// to channels that aren't fully set up yet. For example, the engine isn't
// running yet or the channel's message handler isn't set up on the Dart side
// yet.
void Resize(int new_size) {
internal::ResizeChannel(messenger_, name_, new_size);
}

// Defines whether the channel should show warning messages when discarding
// messages due to overflow.
//
// When |warns| is false, the channel is expected to overflow and warning
// messages will not be shown.
void SetWarnsOnOverflow(bool warns) {
internal::SetChannelWarnsOnOverflow(messenger_, name_, warns);
}

private:
BinaryMessenger* messenger_;
std::string name_;
Expand Down
Loading