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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: tools/viewer/sk_app/android/surface_glue_android.h
diff --git a/tools/viewer/sk_app/android/surface_glue_android.h b/tools/viewer/sk_app/android/surface_glue_android.h
index 296112258e4ea5b3d92af374e90eb32e08f74a91..19cacb0cb62c7feed17d58c24c5045538e5172c3 100644
--- a/tools/viewer/sk_app/android/surface_glue_android.h
+++ b/tools/viewer/sk_app/android/surface_glue_android.h
@@ -37,19 +37,30 @@ struct Message {
};
struct SkiaAndroidApp {
- int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
Application* fApp;
Window* fWindow;
- ANativeWindow* fNativeWindow;
+ jobject fAndroidApp;
- SkiaAndroidApp();
+ SkiaAndroidApp(JNIEnv* env, jobject androidApp);
+
+ // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
~SkiaAndroidApp();
- void postMessage(const Message& message);
- void readMessage(Message* message);
+
+ void postMessage(const Message& message) const;
+ void readMessage(Message* message) const;
void paintIfNeeded();
+ // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive
+ void setTitle(const char* title) const;
private:
pthread_t fThread;
+ ANativeWindow* fNativeWindow;
+ int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe
+ JavaVM* fJavaVM;
+ JNIEnv* fPThreadEnv;
+
+ static int message_callback(int fd, int events, void* data);
+ static void* pthread_main(void*);
};
} // namespace sk_app

Powered by Google App Engine
This is Rietveld 408576698