Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::ServiceTestMessageHandler Class Reference
Inheritance diagram for dart::ServiceTestMessageHandler:
dart::MessageHandler

Public Member Functions

 ServiceTestMessageHandler ()
 
 ~ServiceTestMessageHandler ()
 
MessageStatus HandleMessage (std::unique_ptr< Message > message)
 
const char * msg () const
 
virtual Isolateisolate () const
 
- 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 33 of file service_test.cc.

Constructor & Destructor Documentation

◆ ServiceTestMessageHandler()

dart::ServiceTestMessageHandler::ServiceTestMessageHandler ( )
inline

Definition at line 35 of file service_test.cc.

35: _msg(nullptr) {}

◆ ~ServiceTestMessageHandler()

dart::ServiceTestMessageHandler::~ServiceTestMessageHandler ( )
inline

Definition at line 37 of file service_test.cc.

37 {
39 free(_msg);
40 }
static void ClosePorts(MessageHandler *handler)
Definition: port.cc:128

Member Function Documentation

◆ HandleMessage()

MessageStatus dart::ServiceTestMessageHandler::HandleMessage ( std::unique_ptr< Message message)
inlinevirtual

Implements dart::MessageHandler.

Definition at line 42 of file service_test.cc.

42 {
43 if (_msg != nullptr) {
44 free(_msg);
45 _msg = nullptr;
46 }
47
48 // Parse the message.
49 Object& response_obj = Object::Handle();
50 if (message->IsRaw()) {
51 response_obj = message->raw_obj();
52 } else {
53 Thread* thread = Thread::Current();
54 response_obj = ReadMessage(thread, message.get());
55 }
56 if (response_obj.IsString()) {
57 String& response = String::Handle();
58 response ^= response_obj.ptr();
59 _msg = Utils::StrDup(response.ToCString());
60 } else {
61 ASSERT(response_obj.IsArray());
62 Array& response_array = Array::Handle();
63 response_array ^= response_obj.ptr();
64 ASSERT(response_array.Length() == 1);
65 ExternalTypedData& response = ExternalTypedData::Handle();
66 response ^= response_array.At(0);
67 _msg = Utils::StrDup(reinterpret_cast<char*>(response.DataAddr(0)));
68 }
69
70 return kOK;
71 }
Thread * thread() const
static Object & Handle()
Definition: object.h:407
static Thread * Current()
Definition: thread.h:362
static char * StrDup(const char *s)
#define ASSERT(E)
Win32Message message
ObjectPtr ReadMessage(Thread *thread, Message *message)

◆ isolate()

virtual Isolate * dart::ServiceTestMessageHandler::isolate ( ) const
inlinevirtual

Reimplemented from dart::MessageHandler.

Definition at line 75 of file service_test.cc.

75{ return Isolate::Current(); }
static Isolate * Current()
Definition: isolate.h:986

◆ msg()

const char * dart::ServiceTestMessageHandler::msg ( ) const
inline

Definition at line 73 of file service_test.cc.

73{ return _msg; }

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