OLD | NEW |
(Empty) | |
| 1 #ifndef DART_HOST_H |
| 2 #define DART_HOST_H |
| 3 |
| 4 #include <android_native_app_glue.h> |
| 5 #include "include/dart_api.h" |
| 6 #include "bin/dartutils.h" |
| 7 #include "activity_handler.h" |
| 8 #include "input_service.h" |
| 9 #include "timer.h" |
| 10 #include "graphics.h" |
| 11 #include "context.h" |
| 12 #include "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 DartHost(Context* pContext); |
| 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** pData, int32_t pSize); |
| 37 void onConfigurationChanged(); |
| 38 void onLowMemory(); |
| 39 void onCreateWindow(); |
| 40 void onDestroyWindow(); |
| 41 void onGainedFocus(); |
| 42 void onLostFocus(); |
| 43 |
| 44 private: |
| 45 |
| 46 void clear(); |
| 47 int32_t activate(); |
| 48 void deactivate(); |
| 49 |
| 50 ANativeWindow_Buffer mWindowBuffer; |
| 51 InputHandler *mInputHandler; |
| 52 Timer* mTimer; |
| 53 Graphics *mGraphics; |
| 54 VMGlue *mVmGlue; |
| 55 bool mActive; |
| 56 }; |
| 57 |
| 58 #endif |
| 59 |
OLD | NEW |