OLD | NEW |
(Empty) | |
| 1 #ifndef DART_HOST_H |
| 2 #define DART_HOST_H |
| 3 |
| 4 #include <android_native_app_glue.h> |
| 5 #include "bin/dartutils.h" |
| 6 #include "include/dart_api.h" |
| 7 #include "jni/activity_handler.h" |
| 8 #include "jni/context.h" |
| 9 #include "jni/graphics.h" |
| 10 #include "jni/input_service.h" |
| 11 #include "jni/timer.h" |
| 12 #include "jni/vm_glue.h" |
| 13 |
| 14 // Currently the life cycle management is very crude. We conservatively |
| 15 // shutdown the main isolate when we lose focus and create a new one when |
| 16 // we resume. This needs to be improved later when we understand this better, |
| 17 // and we need some hooks to tell the Dart script to save/restore state |
| 18 // (and an API that will support that). |
| 19 |
| 20 class DartHost : public ActivityHandler { |
| 21 public: |
| 22 explicit DartHost(Context* context); |
| 23 virtual ~DartHost(); |
| 24 |
| 25 protected: |
| 26 int32_t OnActivate(); |
| 27 void OnDeactivate(); |
| 28 int32_t OnStep(); |
| 29 |
| 30 void OnStart(); |
| 31 void OnResume(); |
| 32 void OnPause(); |
| 33 void OnStop(); |
| 34 void OnDestroy(); |
| 35 |
| 36 void OnSaveState(void** data, size_t size); |
| 37 void OnConfigurationChanged(); |
| 38 void OnLowMemory(); |
| 39 void OnCreateWindow(); |
| 40 void OnDestroyWindow(); |
| 41 void OnGainedFocus(); |
| 42 void OnLostFocus(); |
| 43 |
| 44 private: |
| 45 void Clear(); |
| 46 int32_t Activate(); |
| 47 void Deactivate(); |
| 48 |
| 49 ANativeWindow_Buffer window_buffer_; |
| 50 InputHandler* input_handler_; |
| 51 Timer* timer_; |
| 52 Graphics* graphics_; |
| 53 VMGlue* vm_glue_; |
| 54 bool active_; |
| 55 }; |
| 56 |
| 57 #endif |
| 58 |
OLD | NEW |