Flutter Engine
 
Loading...
Searching...
No Matches
embedder_platform_message_response.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
8
9namespace flutter {
10
15
17
18// |PlatformMessageResponse|
19void EmbedderPlatformMessageResponse::Complete(
20 std::unique_ptr<fml::Mapping> data) {
21 if (!data) {
22 CompleteEmpty();
23 return;
24 }
25
26 runner_->PostTask(
27 // The static leak checker gets confused by the use of fml::MakeCopyable.
28 // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
29 fml::MakeCopyable([data = std::move(data), callback = callback_]() {
30 callback(data->GetMapping(), data->GetSize());
31 }));
32}
33
34// |PlatformMessageResponse|
35void EmbedderPlatformMessageResponse::CompleteEmpty() {
36 Complete(std::make_unique<fml::NonOwnedMapping>(nullptr, 0u));
37}
38
39} // namespace flutter
~EmbedderPlatformMessageResponse() override
Destroys the message response. Can be called on any thread. Does not execute unfulfilled callbacks.
std::function< void(const uint8_t *data, size_t size)> Callback
EmbedderPlatformMessageResponse(fml::RefPtr< fml::TaskRunner > runner, const Callback &callback)
virtual void PostTask(const fml::closure &task) override
FlutterDesktopBinaryReply callback
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switch_defs.h:36
internal::CopyableLambda< T > MakeCopyable(T lambda)
Definition ref_ptr.h:261