Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | List of all members
flutter::EmbedderPlatformMessageResponse Class Reference

The platform message response subclass for responses to messages from the embedder to the framework. Message responses are fulfilled by the framework. More...

#include <embedder_platform_message_response.h>

Inheritance diagram for flutter::EmbedderPlatformMessageResponse:
flutter::PlatformMessageResponse fml::RefCountedThreadSafe< PlatformMessageResponse > fml::internal::RefCountedThreadSafeBase

Public Types

using Callback = std::function< void(const uint8_t *data, size_t size)>
 

Public Member Functions

 EmbedderPlatformMessageResponse (fml::RefPtr< fml::TaskRunner > runner, const Callback &callback)
 
 ~EmbedderPlatformMessageResponse () override
 Destroys the message response. Can be called on any thread. Does not execute unfulfilled callbacks.
 
- Public Member Functions inherited from flutter::PlatformMessageResponse
bool is_complete () const
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< PlatformMessageResponse >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 

Private Member Functions

void Complete (std::unique_ptr< fml::Mapping > data) override
 
void CompleteEmpty () override
 

Additional Inherited Members

- Protected Member Functions inherited from flutter::PlatformMessageResponse
 PlatformMessageResponse ()
 
virtual ~PlatformMessageResponse ()
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< PlatformMessageResponse >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Attributes inherited from flutter::PlatformMessageResponse
bool is_complete_ = false
 

Detailed Description

The platform message response subclass for responses to messages from the embedder to the framework. Message responses are fulfilled by the framework.

Definition at line 18 of file embedder_platform_message_response.h.

Member Typedef Documentation

◆ Callback

using flutter::EmbedderPlatformMessageResponse::Callback = std::function<void(const uint8_t* data, size_t size)>

Definition at line 20 of file embedder_platform_message_response.h.

Constructor & Destructor Documentation

◆ EmbedderPlatformMessageResponse()

flutter::EmbedderPlatformMessageResponse::EmbedderPlatformMessageResponse ( fml::RefPtr< fml::TaskRunner runner,
const Callback callback 
)
Parameters
[in]runnerThe task runner on which to execute the callback. The response will be initiated by the framework on the UI thread.
[in]callbackThe callback that communicates to the embedder the contents of the response sent by the framework back to the emebder.

Definition at line 11 of file embedder_platform_message_response.cc.

14 : runner_(std::move(runner)), callback_(callback) {}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ ~EmbedderPlatformMessageResponse()

flutter::EmbedderPlatformMessageResponse::~EmbedderPlatformMessageResponse ( )
overridedefault

Destroys the message response. Can be called on any thread. Does not execute unfulfilled callbacks.

Member Function Documentation

◆ Complete()

void flutter::EmbedderPlatformMessageResponse::Complete ( std::unique_ptr< fml::Mapping data)
overrideprivatevirtual

Implements flutter::PlatformMessageResponse.

Definition at line 19 of file embedder_platform_message_response.cc.

20 {
21 if (!data) {
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}
virtual void PostTask(const fml::closure &task) override
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 switches.h:41
internal::CopyableLambda< T > MakeCopyable(T lambda)

◆ CompleteEmpty()

void flutter::EmbedderPlatformMessageResponse::CompleteEmpty ( )
overrideprivatevirtual

Implements flutter::PlatformMessageResponse.

Definition at line 35 of file embedder_platform_message_response.cc.

35 {
36 Complete(std::make_unique<fml::NonOwnedMapping>(nullptr, 0u));
37}
void Complete(std::unique_ptr< fml::Mapping > data) override

The documentation for this class was generated from the following files: