| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DART_HOST_H | 5 #ifndef EMBEDDERS_ANDROID_DART_HOST_H_ |
| 6 #define DART_HOST_H | 6 #define EMBEDDERS_ANDROID_DART_HOST_H_ |
| 7 | 7 |
| 8 #include <android_native_app_glue.h> | 8 #include <android_native_app_glue.h> |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "jni/activity_handler.h" | 10 #include "embedders/android/activity_handler.h" |
| 11 #include "jni/context.h" | 11 #include "embedders/android/context.h" |
| 12 #include "jni/graphics.h" | 12 #include "embedders/android/graphics.h" |
| 13 #include "jni/input_service.h" | 13 #include "embedders/android/input_service.h" |
| 14 #include "jni/sound_service.h" | 14 #include "embedders/android/sound_service.h" |
| 15 #include "jni/timer.h" | 15 #include "embedders/android/timer.h" |
| 16 #include "jni/vm_glue.h" | 16 #include "embedders/android/vm_glue.h" |
| 17 | 17 |
| 18 // Currently the life cycle management is very crude. We conservatively | 18 // Currently the life cycle management is very crude. We conservatively |
| 19 // shutdown the main isolate when we lose focus and create a new one when | 19 // shutdown the main isolate when we lose focus and create a new one when |
| 20 // we resume. This needs to be improved later when we understand this better, | 20 // we resume. This needs to be improved later when we understand this better, |
| 21 // and we need some hooks to tell the Dart script to save/restore state | 21 // and we need some hooks to tell the Dart script to save/restore state |
| 22 // (and an API that will support that). | 22 // (and an API that will support that). |
| 23 | 23 |
| 24 class DartHost : public ActivityHandler { | 24 class DartHost : public ActivityHandler { |
| 25 public: | 25 public: |
| 26 explicit DartHost(Context* context); | 26 explicit DartHost(Context* context); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 44 void OnDestroyWindow(); | 44 void OnDestroyWindow(); |
| 45 void OnGainedFocus(); | 45 void OnGainedFocus(); |
| 46 void OnLostFocus(); | 46 void OnLostFocus(); |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 void Clear(); | 49 void Clear(); |
| 50 int32_t Activate(); | 50 int32_t Activate(); |
| 51 void Deactivate(); | 51 void Deactivate(); |
| 52 | 52 |
| 53 ANativeWindow_Buffer window_buffer_; | 53 ANativeWindow_Buffer window_buffer_; |
| 54 Graphics* graphics_; |
| 54 InputHandler* input_handler_; | 55 InputHandler* input_handler_; |
| 55 Graphics* graphics_; | |
| 56 SoundService* sound_service_; | 56 SoundService* sound_service_; |
| 57 Timer* timer_; | 57 Timer* timer_; |
| 58 VMGlue* vm_glue_; | 58 VMGlue* vm_glue_; |
| 59 bool active_; | 59 bool active_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 #endif | 62 #endif // EMBEDDERS_ANDROID_DART_HOST_H_ |
| 63 | |
| OLD | NEW |