Skip to content

Commit 7e77d5c

Browse files
authored
Revert "Allow specification of std::functions as native entrypoints from Dart code. (flutter#8309)" (flutter#8312)
This reverts commit 400a86a.
1 parent 400a86a commit 7e77d5c

File tree

3 files changed

+0
-64
lines changed

3 files changed

+0
-64
lines changed

shell/platform/embedder/fixtures/simple_main.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,3 @@ void customEntrypoint() {
66
}
77

88
void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint";
9-
10-
11-
@pragma('vm:entry-point')
12-
void customEntrypoint1() {
13-
sayHiFromCustomEntrypoint1();
14-
sayHiFromCustomEntrypoint2();
15-
sayHiFromCustomEntrypoint3();
16-
}
17-
18-
void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1";
19-
void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2";
20-
void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3";

shell/platform/embedder/tests/embedder_context.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,11 @@
1616
#include "flutter/shell/platform/embedder/embedder.h"
1717
#include "flutter/shell/platform/embedder/tests/embedder_test_resolver.h"
1818

19-
#define CREATE_NATIVE_ENTRY(native_entry) \
20-
({ \
21-
static ::shell::testing::EmbedderContext::NativeEntry closure; \
22-
static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \
23-
closure(args); \
24-
}; \
25-
closure = (native_entry); \
26-
entrypoint; \
27-
})
28-
2919
namespace shell {
3020
namespace testing {
3121

3222
class EmbedderContext {
3323
public:
34-
using NativeEntry = std::function<void(Dart_NativeArguments)>;
35-
3624
EmbedderContext(std::string assets_path = "");
3725

3826
~EmbedderContext();

shell/platform/embedder/tests/embedder_unittests.cc

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -59,45 +59,5 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypoint) {
5959
ASSERT_TRUE(engine.is_valid());
6060
}
6161

62-
TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) {
63-
auto& context = GetEmbedderContext();
64-
65-
fml::AutoResetWaitableEvent latch1;
66-
fml::AutoResetWaitableEvent latch2;
67-
fml::AutoResetWaitableEvent latch3;
68-
69-
// Can be defined separately.
70-
auto entry1 = [&latch1](Dart_NativeArguments args) {
71-
FML_LOG(ERROR) << "In Callback 1";
72-
latch1.Signal();
73-
};
74-
auto native_entry1 = CREATE_NATIVE_ENTRY(entry1);
75-
context.AddNativeCallback("SayHiFromCustomEntrypoint1", native_entry1);
76-
77-
// Can be wrapped in in the args.
78-
auto entry2 = [&latch2](Dart_NativeArguments args) {
79-
FML_LOG(ERROR) << "In Callback 2";
80-
latch2.Signal();
81-
};
82-
context.AddNativeCallback("SayHiFromCustomEntrypoint2",
83-
CREATE_NATIVE_ENTRY(entry2));
84-
85-
// Everything can be inline.
86-
context.AddNativeCallback(
87-
"SayHiFromCustomEntrypoint3",
88-
CREATE_NATIVE_ENTRY([&latch3](Dart_NativeArguments args) {
89-
FML_LOG(ERROR) << "In Callback 3";
90-
latch3.Signal();
91-
}));
92-
93-
EmbedderConfigBuilder builder(context);
94-
builder.SetDartEntrypoint("customEntrypoint1");
95-
auto engine = builder.LaunchEngine();
96-
latch1.Wait();
97-
latch2.Wait();
98-
latch3.Wait();
99-
ASSERT_TRUE(engine.is_valid());
100-
}
101-
10262
} // namespace testing
10363
} // namespace shell

0 commit comments

Comments
 (0)