Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/viewer/sk_app/android/surface_glue_android.h

Issue 1978843002: Change Android activity title from JNI call (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Revision Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef surface_glue_android_DEFINED 8 #ifndef surface_glue_android_DEFINED
9 #define surface_glue_android_DEFINED 9 #define surface_glue_android_DEFINED
10 10
(...skipping 19 matching lines...) Expand all
30 struct Message { 30 struct Message {
31 MessageType fType = kUndefined; 31 MessageType fType = kUndefined;
32 ANativeWindow* fNativeWindow = nullptr; 32 ANativeWindow* fNativeWindow = nullptr;
33 int keycode = 0; 33 int keycode = 0;
34 34
35 Message() {} 35 Message() {}
36 Message(MessageType t) : fType(t) {} 36 Message(MessageType t) : fType(t) {}
37 }; 37 };
38 38
39 struct SkiaAndroidApp { 39 struct SkiaAndroidApp {
40 int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
41 Application* fApp; 40 Application* fApp;
42 Window* fWindow; 41 Window* fWindow;
43 ANativeWindow* fNativeWindow; 42 jobject fAndroidApp;
44 43
45 SkiaAndroidApp(); 44 SkiaAndroidApp(JNIEnv* env, jobject androidApp);
45
46 // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
46 ~SkiaAndroidApp(); 47 ~SkiaAndroidApp();
47 void postMessage(const Message& message); 48
48 void readMessage(Message* message); 49 void postMessage(const Message& message) const;
50 void readMessage(Message* message) const;
49 void paintIfNeeded(); 51 void paintIfNeeded();
50 52
53 // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
54 void setTitle(const char* title) const;
51 private: 55 private:
52 pthread_t fThread; 56 pthread_t fThread;
57 ANativeWindow* fNativeWindow;
58 int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
59 JavaVM* fJavaVM;
60 JNIEnv* fPThreadEnv;
61
62 static int message_callback(int fd, int events, void* data);
63 static void* pthread_main(void*);
53 }; 64 };
54 65
55 } // namespace sk_app 66 } // namespace sk_app
56 67
57 #endif 68 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698