Chromium Code Reviews| 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 a4698336f04b4ea1489eb7a1caaf70b84b5b4f92..fdc4e22dfcba68aadda32e004f3288ce793f836f 100644 |
| --- a/tools/viewer/sk_app/android/surface_glue_android.h |
| +++ b/tools/viewer/sk_app/android/surface_glue_android.h |
| @@ -25,7 +25,8 @@ enum MessageType { |
| kDestroyApp, |
| kContentInvalidated, |
| kKeyPressed, |
| - kTouched |
| + kTouched, |
| + kSetState |
| }; |
| struct Message { |
| @@ -35,6 +36,10 @@ struct Message { |
| int fTouchOwner, fTouchState; |
| float fTouchX, fTouchY; |
| + // Make sure to delete following SkStrings after consumption |
| + SkString* stateName; |
|
djsollen
2016/05/24 17:32:40
don't store pointers just store an SkString
liyuqian
2016/05/24 20:18:05
We'll preserve the pointers because of the message
|
| + SkString* stateValue; |
| + |
| Message() {} |
| Message(MessageType t) : fType(t) {} |
| }; |
| @@ -49,8 +54,9 @@ struct SkiaAndroidApp { |
| void postMessage(const Message& message) const; |
| void readMessage(Message* message) const; |
| - // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive |
| + // These must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive |
| void setTitle(const char* title) const; |
| + void updateState(const char* stateJsonStr) const; |
| private: |
| pthread_t fThread; |
| @@ -58,7 +64,7 @@ private: |
| int fPipes[2]; // 0 is the read message pipe, 1 is the write message pipe |
| JavaVM* fJavaVM; |
| JNIEnv* fPThreadEnv; |
| - jmethodID fSetTitleMethodID; |
| + jmethodID fSetTitleMethodID, fUpdateStateMethodID; |
| // This must be called in SkiaAndroidApp's own pthread because the JNIEnv is thread sensitive |
| ~SkiaAndroidApp(); |