Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::bin::EventHandler Class Reference

#include <eventhandler.h>

Public Member Functions

 EventHandler ()
 
void SendData (intptr_t id, Dart_Port dart_port, int64_t data)
 
void NotifyShutdownDone ()
 

Static Public Member Functions

static void Start ()
 
static void Stop ()
 
static EventHandlerImplementationdelegate ()
 
static void SendFromNative (intptr_t id, Dart_Port port, int64_t data)
 

Friends

class EventHandlerImplementation
 

Detailed Description

Definition at line 603 of file eventhandler.h.

Constructor & Destructor Documentation

◆ EventHandler()

dart::bin::EventHandler::EventHandler ( )
inline

Definition at line 605 of file eventhandler.h.

605{}

Member Function Documentation

◆ delegate()

EventHandlerImplementation * dart::bin::EventHandler::delegate ( )
static

Definition at line 64 of file eventhandler.cc.

64 {
65 if (event_handler == nullptr) {
66 return nullptr;
67 }
68 return &event_handler->delegate_;
69}
static EventHandler * event_handler

◆ NotifyShutdownDone()

void dart::bin::EventHandler::NotifyShutdownDone ( )

Signal to main thread that event handler is done.

Definition at line 35 of file eventhandler.cc.

35 {
36 MonitorLocker ml(shutdown_monitor);
37 ml.Notify();
38}
static Monitor * shutdown_monitor

◆ SendData()

void dart::bin::EventHandler::SendData ( intptr_t  id,
Dart_Port  dart_port,
int64_t  data 
)
inline

Definition at line 606 of file eventhandler.h.

606 {
607 delegate_.SendData(id, dart_port, data);
608 }
void SendData(intptr_t id, Dart_Port dart_port, int64_t data)
static int8_t data[kExtLength]

◆ SendFromNative()

void dart::bin::EventHandler::SendFromNative ( intptr_t  id,
Dart_Port  port,
int64_t  data 
)
static

Definition at line 71 of file eventhandler.cc.

71 {
72 event_handler->SendData(id, port, data);
73}
void SendData(intptr_t id, Dart_Port dart_port, int64_t data)

◆ Start()

void dart::bin::EventHandler::Start ( )
static

Start the event-handler.

Definition at line 21 of file eventhandler.cc.

21 {
22 // Initialize global socket registry.
24
25 ASSERT(event_handler == nullptr);
26 shutdown_monitor = new Monitor();
29
31 FATAL("Failed to initialize sockets");
32 }
33}
void Start(EventHandler *handler)
static bool Initialize()
#define ASSERT(E)
#define FATAL(error)

◆ Stop()

void dart::bin::EventHandler::Stop ( )
static

Stop the event-handler. It's expected that there will be no further calls to SendData after a call to Stop.

Definition at line 40 of file eventhandler.cc.

40 {
41 if (event_handler == nullptr) {
42 return;
43 }
44
45 // Wait until it has stopped.
46 {
47 MonitorLocker ml(shutdown_monitor);
48
49 // Signal to event handler that we want it to stop.
50 event_handler->delegate_.Shutdown();
51 ml.Wait(Monitor::kNoTimeout);
52 }
53
54 // Cleanup
55 delete event_handler;
56 event_handler = nullptr;
57 delete shutdown_monitor;
58 shutdown_monitor = nullptr;
59
60 // Destroy the global socket registry.
62}
static constexpr int64_t kNoTimeout
Definition thread.h:79

Friends And Related Symbol Documentation

◆ EventHandlerImplementation

friend class EventHandlerImplementation
friend

Definition at line 631 of file eventhandler.h.


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