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

Commit 3ebcde6

Browse files
Revert "[windows] Expose the binary messenger from FlutterEngine (#20399)" (#20550)
This reverts commit 7fa21a4.
1 parent 7fa21a4 commit 3ebcde6

24 files changed

+193
-314
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,7 @@ FILE: ../../../flutter/shell/platform/android/surface/android_surface_mock.h
836836
FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.cc
837837
FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.h
838838
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/basic_message_channel_unittests.cc
839-
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/binary_messenger_impl.h
840839
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/byte_buffer_streams.h
841-
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/core_implementations.cc
842840
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc
843841
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/engine_method_result.cc
844842
FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/event_channel_unittests.cc

shell/platform/common/cpp/client_wrapper/BUILD.gn

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import("core_wrapper_files.gni")
88
# Client library build for internal use by the shell implementation.
99
source_set("client_wrapper") {
1010
sources = core_cpp_client_wrapper_sources
11-
public = core_cpp_client_wrapper_includes +
12-
core_cpp_client_wrapper_internal_headers
11+
public = core_cpp_client_wrapper_includes
1312

1413
deps = [ "//flutter/shell/platform/common/cpp:common_cpp_library_headers" ]
1514

shell/platform/common/cpp/client_wrapper/binary_messenger_impl.h

Lines changed: 0 additions & 50 deletions
This file was deleted.

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

Lines changed: 0 additions & 150 deletions
This file was deleted.

shell/platform/common/cpp/client_wrapper/core_wrapper_files.gni

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,13 @@ core_cpp_client_wrapper_includes =
2727
],
2828
"abspath")
2929

30-
# Headers that aren't public for clients of the wrapper, but are considered
31-
# public for the purpose of BUILD dependencies (e.g., to allow
32-
# windows/client_wrapper implementation files to include them).
33-
core_cpp_client_wrapper_internal_headers =
34-
get_path_info([
35-
"binary_messenger_impl.h",
36-
"byte_buffer_streams.h",
37-
],
38-
"abspath")
39-
4030
# TODO: Once the wrapper API is more stable, consolidate to as few files as is
4131
# reasonable (without forcing different kinds of clients to take unnecessary
4232
# code) to simplify use.
4333
core_cpp_client_wrapper_sources = get_path_info([
44-
"core_implementations.cc",
34+
"byte_buffer_streams.h",
35+
"engine_method_result.cc",
4536
"plugin_registrar.cc",
4637
"standard_codec.cc",
4738
],
4839
"abspath")
49-
50-
# Temporary shim, published for backwards compatibility.
51-
# See comment in the file for more detail.
52-
temporary_shim_files = get_path_info([ "engine_method_result.cc" ], "abspath")

shell/platform/common/cpp/client_wrapper/engine_method_result.cc

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,44 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// This file is deprecated in favor of core_implementations.cc. This is a
6-
// temporary forwarding implementation so that the switch to
7-
// core_implementations.cc isn't an immediate breaking change, allowing for the
8-
// template to be updated to include it and update the template version before
9-
// removing this file.
5+
#include "include/flutter/engine_method_result.h"
106

11-
#include "core_implementations.cc"
7+
#include <assert.h>
8+
#include <iostream>
9+
10+
namespace flutter {
11+
namespace internal {
12+
13+
ReplyManager::ReplyManager(BinaryReply reply_handler)
14+
: reply_handler_(std::move(reply_handler)) {
15+
assert(reply_handler_);
16+
}
17+
18+
ReplyManager::~ReplyManager() {
19+
if (reply_handler_) {
20+
// Warn, rather than send a not-implemented response, since the engine may
21+
// no longer be valid at this point.
22+
std::cerr
23+
<< "Warning: Failed to respond to a message. This is a memory leak."
24+
<< std::endl;
25+
}
26+
}
27+
28+
void ReplyManager::SendResponseData(const std::vector<uint8_t>* data) {
29+
if (!reply_handler_) {
30+
std::cerr
31+
<< "Error: Only one of Success, Error, or NotImplemented can be "
32+
"called,"
33+
<< " and it can be called exactly once. Ignoring duplicate result."
34+
<< std::endl;
35+
return;
36+
}
37+
38+
const uint8_t* message = data && !data->empty() ? data->data() : nullptr;
39+
size_t message_size = data ? data->size() : 0;
40+
reply_handler_(message, message_size);
41+
reply_handler_ = nullptr;
42+
}
43+
44+
} // namespace internal
45+
} // namespace flutter

0 commit comments

Comments
 (0)