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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9473f64bc2ace7b97169226c072259ca1a639f2b |
| --- /dev/null |
| +++ b/tools/viewer/sk_app/android/surface_glue_android.h |
| @@ -0,0 +1,47 @@ |
| +/* |
| +* Copyright 2016 Google Inc. |
| +* |
| +* Use of this source code is governed by a BSD-style license that can be |
| +* found in the LICENSE file. |
| +*/ |
| + |
| +#ifndef surface_glue_android_DEFINED |
| +#define surface_glue_android_DEFINED |
| + |
| +#include <pthread.h> |
| + |
| +#include <android/native_window_jni.h> |
| +#include <android_native_app_glue.h> |
| + |
| +#include "../Application.h" |
| +#include "../Window.h" |
| + |
| +namespace sk_app { |
| + |
| +enum MessageType { kSurfaceCreated, kSurfaceChanged, kSurfaceDestroyed, kDestroyApp }; |
| + |
| +struct Message { |
| + MessageType type; |
| + |
| + Message() {} |
| + Message(MessageType t) : type(t) {} |
| +}; |
| + |
| +void* pthread_main(void* arg); |
|
djsollen
2016/05/06 18:45:26
we don't need to expose this outside the cpp file.
djsollen
2016/05/06 18:58:53
Ignore this comment.
|
| + |
| +struct AppThread { |
|
djsollen
2016/05/06 18:45:26
let's call it something more generic skia_android_
liyuqian
2016/05/06 20:42:30
Done.
|
| + pthread_t thread; |
|
jvanverth1
2016/05/06 17:02:07
Again: fThread, fPipes, etc.
djsollen
2016/05/06 18:45:26
make datastructures like fThread private.
liyuqian
2016/05/06 20:42:30
Done.
|
| + int pipes[2]; // 0 is the read message pipe, 1 is the write message pipe |
| + ANativeWindow* nativeWindow; |
| + Application* app; |
| + Window* window; |
| + |
|
djsollen
2016/05/06 18:45:26
add a function pointer here that look something li
djsollen
2016/05/06 18:58:53
Ignore this comment.
|
| + AppThread(); |
| + ~AppThread(); |
| + void postMessage(const Message& message); |
| + void readMessage(Message* message); |
| +}; |
| + |
| +} // namespace sk_app |
| + |
| +#endif |