Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::NativeMessageHandler Class Reference

#include <native_message_handler.h>

Inheritance diagram for dart::NativeMessageHandler:
dart::MessageHandler

Public Member Functions

 NativeMessageHandler (const char *name, Dart_NativeMessageHandler func)
 
 ~NativeMessageHandler ()
 
const char * name () const
 
Dart_NativeMessageHandler func () const
 
MessageStatus HandleMessage (std::unique_ptr< Message > message)
 
- Public Member Functions inherited from dart::MessageHandler
virtual ~MessageHandler ()
 
virtual const char * name () const
 
bool Run (ThreadPool *pool, StartCallback start_callback, EndCallback end_callback, CallbackData data)
 
MessageStatus HandleNextMessage ()
 
MessageStatus HandleOOBMessages ()
 
MessageStatus PauseAndHandleAllMessages (int64_t timeout_millis)
 
bool HasOOBMessages ()
 
bool HasMessages ()
 
virtual bool KeepAliveLocked ()
 
void RequestDeletion ()
 
bool paused () const
 
void increment_paused ()
 
void decrement_paused ()
 
void DebugDump ()
 
bool should_pause_on_start () const
 
void set_should_pause_on_start (bool should_pause_on_start)
 
bool is_paused_on_start () const
 
bool should_pause_on_exit () const
 
void set_should_pause_on_exit (bool should_pause_on_exit)
 
bool is_paused_on_exit () const
 
int64_t paused_timestamp () const
 
bool ShouldPauseOnStart (MessageStatus status) const
 
bool ShouldPauseOnExit (MessageStatus status) const
 
void PausedOnStart (bool paused)
 
void PausedOnExit (bool paused)
 

Additional Inherited Members

- Public Types inherited from dart::MessageHandler
enum  MessageStatus { kOK , kError , kShutdown }
 
typedef uword CallbackData
 
typedef MessageStatus(* StartCallback) (CallbackData data)
 
typedef void(* EndCallback) (CallbackData data)
 
- Static Public Member Functions inherited from dart::MessageHandler
static const char * MessageStatusString (MessageStatus status)
 
- Protected Member Functions inherited from dart::MessageHandler
 MessageHandler ()
 
virtual bool IsCurrentIsolate () const
 
virtual Isolateisolate () const
 
void PostMessage (std::unique_ptr< Message > message, bool before_events=false)
 
void ClosePort (Dart_Port port)
 
void CloseAllPorts ()
 
virtual void MessageNotify (Message::Priority priority)
 
virtual MessageStatus HandleMessage (std::unique_ptr< Message > message)=0
 
virtual void NotifyPauseOnStart ()
 
virtual void NotifyPauseOnExit ()
 
Threadthread () const
 

Detailed Description

Definition at line 18 of file native_message_handler.h.

Constructor & Destructor Documentation

◆ NativeMessageHandler()

dart::NativeMessageHandler::NativeMessageHandler ( const char *  name,
Dart_NativeMessageHandler  func 
)

Definition at line 17 of file native_message_handler.cc.

19 : name_(Utils::StrDup(name)), func_(func) {}
Dart_NativeMessageHandler func() const
static char * StrDup(const char *s)

◆ ~NativeMessageHandler()

dart::NativeMessageHandler::~NativeMessageHandler ( )

Definition at line 21 of file native_message_handler.cc.

21 {
22 free(name_);
23}

Member Function Documentation

◆ func()

Dart_NativeMessageHandler dart::NativeMessageHandler::func ( ) const
inline

Definition at line 24 of file native_message_handler.h.

24{ return func_; }

◆ HandleMessage()

MessageHandler::MessageStatus dart::NativeMessageHandler::HandleMessage ( std::unique_ptr< Message message)
virtual

Implements dart::MessageHandler.

Definition at line 31 of file native_message_handler.cc.

32 {
33 if (message->IsOOB()) {
34 // We currently do not use OOB messages for native ports.
36 }
37 // We create a native scope for handling the message.
38 // All allocation of objects for decoding the message is done in the
39 // zone associated with this scope.
40 ApiNativeScope scope;
41 Dart_CObject* object = ReadApiMessage(scope.zone(), message.get());
42 (*func())(message->dest_port(), object);
43 return kOK;
44}
#define UNREACHABLE()
Definition: assert.h:248
Win32Message message
Dart_CObject * ReadApiMessage(Zone *zone, Message *message)

◆ name()

const char * dart::NativeMessageHandler::name ( ) const
inlinevirtual

Reimplemented from dart::MessageHandler.

Definition at line 23 of file native_message_handler.h.

23{ return name_; }

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