Flutter Engine
The Flutter Engine
eventhandler_macos.h
Go to the documentation of this file.
1// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_BIN_EVENTHANDLER_MACOS_H_
6#define RUNTIME_BIN_EVENTHANDLER_MACOS_H_
7
8#if !defined(RUNTIME_BIN_EVENTHANDLER_H_)
9#error Do not include eventhandler_macos.h directly; use eventhandler.h instead.
10#endif
11
12#include <errno.h>
13#include <sys/event.h> // NOLINT
14#include <sys/socket.h>
15#include <unistd.h>
16
17#include "platform/hashmap.h"
19
20namespace dart {
21namespace bin {
22
23class DescriptorInfo : public DescriptorInfoBase {
24 public:
25 explicit DescriptorInfo(intptr_t fd)
27
28 virtual ~DescriptorInfo() {}
29
30 intptr_t GetPollEvents();
31
32 virtual void Close() {
33 close(fd_);
34 fd_ = -1;
35 }
36
38
40
42
44
45 protected:
47
48 private:
49 DISALLOW_COPY_AND_ASSIGN(DescriptorInfo);
50};
51
52class DescriptorInfoSingle : public DescriptorInfoSingleMixin<DescriptorInfo> {
53 public:
54 explicit DescriptorInfoSingle(intptr_t fd)
57
58 private:
59 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingle);
60};
61
62class DescriptorInfoMultiple
63 : public DescriptorInfoMultipleMixin<DescriptorInfo> {
64 public:
65 explicit DescriptorInfoMultiple(intptr_t fd)
68
69 private:
70 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoMultiple);
71};
72
73class EventHandlerImplementation {
74 public:
77
78 void UpdateKQueueInstance(intptr_t old_mask, DescriptorInfo* di);
79
80 // Gets the socket data structure for a given file
81 // descriptor. Creates a new one if one is not found.
82 DescriptorInfo* GetDescriptorInfo(intptr_t fd, bool is_listening);
83 void SendData(intptr_t id, Dart_Port dart_port, int64_t data);
84 void Start(EventHandler* handler);
85 void Shutdown();
86
87 private:
88 int64_t GetTimeout();
89 void HandleEvents(struct kevent* events, int size);
90 void HandleTimeout();
91 static void EventHandlerEntry(uword args);
92 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data);
93 void HandleInterruptFd();
94 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask);
95 intptr_t GetEvents(struct kevent* event, DescriptorInfo* di);
96 static void* GetHashmapKeyFromFd(intptr_t fd);
97 static uint32_t GetHashmapHashFromFd(intptr_t fd);
98
99 SimpleHashMap socket_map_;
100 TimeoutQueue timeout_queue_;
101 bool shutdown_;
102 int interrupt_fds_[2];
103 int kqueue_fd_;
104
105 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation);
106};
107
108} // namespace bin
109} // namespace dart
110
111#endif // RUNTIME_BIN_EVENTHANDLER_MACOS_H_
void set_tracked_by_kqueue(bool value)
void SendData(intptr_t id, Dart_Port dart_port, int64_t data)
void Start(EventHandler *handler)
DescriptorInfo * GetDescriptorInfo(intptr_t fd, bool is_listening)
void UpdateKQueueInstance(intptr_t old_mask, DescriptorInfo *di)
int64_t Dart_Port
Definition: dart_api.h:1525
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent * event
uint8_t value
Definition: dart_vm.cc:33
uintptr_t uword
Definition: globals.h:501
static int8_t data[kExtLength]
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259