Flutter Engine
The Flutter Engine
SurfaceThread.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#ifndef JetSki_SurfaceThread_DEFINED
8#define JetSki_SurfaceThread_DEFINED
9
10#include <pthread.h>
11#include <unistd.h>
12#include <android/looper.h>
14
16
17class WindowSurface;
18
20
26};
27
28struct Message {
31 SkPicture* fPicture = nullptr;
33
36};
37
39public:
41
42 void postMessage(const Message& message) const;
43 void readMessage(Message* message) const;
44 void release();
45private:
46 static void* pthread_main(void* arg);
47 static int message_callback(int fd, int events, void* data);
48 // TODO: This has to be static, which is weird now, but fine in a singleton
49 // Switch to singleton design or find other way to break out of thread loop
50 bool fRunning;
51
52 pthread_t fThread;
53 int fPipe[2]; // acts as a Message queue, read from [0] write to [1]
54};
55
56#endif
MessageType
Definition: SurfaceThread.h:21
@ kRenderPicture
Definition: SurfaceThread.h:25
@ kInitialize
Definition: SurfaceThread.h:23
@ kDestroy
Definition: SurfaceThread.h:24
@ kUndefined
Definition: SurfaceThread.h:22
void postMessage(const Message &message) const
void readMessage(Message *message) const
Win32Message message
Message(MessageType t)
Definition: SurfaceThread.h:35
SkPicture * fPicture
Definition: SurfaceThread.h:31
ANativeWindow * fNativeWindow
Definition: SurfaceThread.h:30
MessageType fType
Definition: SurfaceThread.h:29
WindowSurface ** fWindowSurface
Definition: SurfaceThread.h:32
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
struct ANativeWindow ANativeWindow