Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
surface_glue_android.h
Go to the documentation of this file.
1/*
2* Copyright 2016 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
8#ifndef surface_glue_android_DEFINED
9#define surface_glue_android_DEFINED
10
11#include <pthread.h>
12
13#include <android/native_window_jni.h>
14
16
18#include "tools/sk_app/Window.h"
19
20namespace sk_app {
21
33
47
51 jobject fAndroidApp;
52
53 SkiaAndroidApp(JNIEnv* env, jobject androidApp);
54
55 void postMessage(const Message& message) const;
56 void readMessage(Message* message) const;
57
58 // These must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
59 void setTitle(const char* title) const;
60 void setUIState(const char* state) const;
61
62private:
63 pthread_t fThread;
64 ANativeWindow* fNativeWindow;
65 int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
66 JavaVM* fJavaVM;
67 JNIEnv* fPThreadEnv;
68 jmethodID fSetTitleMethodID, fSetStateMethodID;
69
70 // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
72
73 static int message_callback(int fd, int events, void* data);
74 static void* pthread_main(void*);
75};
76
77} // namespace sk_app
78
79#endif
AtkStateType state
Win32Message message
Definition __init__.py:1
Message(MessageType t)
ANativeWindow * fNativeWindow
void setUIState(const char *state) const
void setTitle(const char *title) const
void readMessage(Message *message) const
void postMessage(const Message &message) const
struct ANativeWindow ANativeWindow