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