Flutter Engine
The Flutter Engine
eventhandler_linux.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_LINUX_H_
6#define RUNTIME_BIN_EVENTHANDLER_LINUX_H_
7
8#if !defined(RUNTIME_BIN_EVENTHANDLER_H_)
9#error Do not include eventhandler_linux.h directly; use eventhandler.h instead.
10#endif
11
12#include <errno.h>
13#include <sys/epoll.h>
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) : DescriptorInfoBase(fd) {}
26
27 virtual ~DescriptorInfo() {}
28
29 intptr_t GetPollEvents();
30
31 virtual void Close() {
32 close(fd_);
33 fd_ = -1;
34 }
35
36 private:
37 DISALLOW_COPY_AND_ASSIGN(DescriptorInfo);
38};
39
40class DescriptorInfoSingle : public DescriptorInfoSingleMixin<DescriptorInfo> {
41 public:
42 explicit DescriptorInfoSingle(intptr_t fd)
45
46 private:
47 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingle);
48};
49
50class DescriptorInfoMultiple
51 : public DescriptorInfoMultipleMixin<DescriptorInfo> {
52 public:
53 explicit DescriptorInfoMultiple(intptr_t fd)
56
57 private:
58 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoMultiple);
59};
60
61class EventHandlerImplementation {
62 public:
65
66 void UpdateEpollInstance(intptr_t old_mask, DescriptorInfo* di);
67
68 // Gets the socket data structure for a given file
69 // descriptor. Creates a new one if one is not found.
70 DescriptorInfo* GetDescriptorInfo(intptr_t fd, bool is_listening);
71 void SendData(intptr_t id, Dart_Port dart_port, int64_t data);
72 void Start(EventHandler* handler);
73 void Shutdown();
74
75 private:
76 void HandleEvents(struct epoll_event* events, int size);
77 static void Poll(uword args);
78 void WakeupHandler(intptr_t id, Dart_Port dart_port, int64_t data);
79 void HandleInterruptFd();
80 void UpdateTimerFd();
81 void SetPort(intptr_t fd, Dart_Port dart_port, intptr_t mask);
82 intptr_t GetPollEvents(intptr_t events, DescriptorInfo* di);
83 static void* GetHashmapKeyFromFd(intptr_t fd);
84 static uint32_t GetHashmapHashFromFd(intptr_t fd);
85
86 SimpleHashMap socket_map_;
87 TimeoutQueue timeout_queue_;
88 bool shutdown_;
89 int interrupt_fds_[2];
90 int epoll_fd_;
91 int timer_fd_;
92
93 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation);
94};
95
96} // namespace bin
97} // namespace dart
98
99#endif // RUNTIME_BIN_EVENTHANDLER_LINUX_H_
void SendData(intptr_t id, Dart_Port dart_port, int64_t data)
void UpdateEpollInstance(intptr_t old_mask, DescriptorInfo *di)
void Start(EventHandler *handler)
DescriptorInfo * GetDescriptorInfo(intptr_t fd, bool is_listening)
int64_t Dart_Port
Definition: dart_api.h:1525
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
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