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

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: Once 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);
46 ~SkiaAndroidApp(); 45
47 void postMessage(const Message& message); 46 void postMessage(const Message& message) const;
48 void readMessage(Message* message); 47 void readMessage(Message* message) const;
49 void paintIfNeeded(); 48 void paintIfNeeded();
50 49
50 // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
51 void setTitle(const char* title) const;
51 private: 52 private:
52 pthread_t fThread; 53 pthread_t fThread;
54 ANativeWindow* fNativeWindow;
55 int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
56 JavaVM* fJavaVM;
57 JNIEnv* fPThreadEnv;
58 jclass fAppClass;
djsollen 2016/05/13 16:19:12 We don't need to hold onto fAppClass
59 jmethodID fSetTitleMethodID;
60
61 // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
62 ~SkiaAndroidApp();
63
64 static int message_callback(int fd, int events, void* data);
65 static void* pthread_main(void*);
53 }; 66 };
54 67
55 } // namespace sk_app 68 } // namespace sk_app
56 69
57 #endif 70 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698