Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Unified Diff: samples/android_sample/jni/dart_host.h

Issue 11434046: Android rayshader sample. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samples/android_sample/jni/dart_host.h
===================================================================
--- samples/android_sample/jni/dart_host.h (revision 0)
+++ samples/android_sample/jni/dart_host.h (revision 0)
@@ -0,0 +1,59 @@
+#ifndef DART_HOST_H
+#define DART_HOST_H
+
+#include <android_native_app_glue.h>
+#include "include/dart_api.h"
+#include "bin/dartutils.h"
+#include "activity_handler.h"
+#include "input_service.h"
+#include "timer.h"
+#include "graphics.h"
+#include "context.h"
+#include "vm_glue.h"
+
+// Currently the life cycle management is very crude. We conservatively
+// shutdown the main isolate when we lose focus and create a new one when
+// we resume. This needs to be improved later when we understand this better,
+// and we need some hooks to tell the Dart script to save/restore state
+// (and an API that will support that).
+
+class DartHost : public ActivityHandler {
+ public:
+ DartHost(Context* pContext);
+ virtual ~DartHost();
+
+ protected:
+ int32_t onActivate();
+ void onDeactivate();
+ int32_t onStep();
+
+ void onStart();
+ void onResume();
+ void onPause();
+ void onStop();
+ void onDestroy();
+
+ void onSaveState(void** pData, int32_t pSize);
+ void onConfigurationChanged();
+ void onLowMemory();
+ void onCreateWindow();
+ void onDestroyWindow();
+ void onGainedFocus();
+ void onLostFocus();
+
+ private:
+
+ void clear();
+ int32_t activate();
+ void deactivate();
+
+ ANativeWindow_Buffer mWindowBuffer;
+ InputHandler *mInputHandler;
+ Timer* mTimer;
+ Graphics *mGraphics;
+ VMGlue *mVmGlue;
+ bool mActive;
+};
+
+#endif
+

Powered by Google App Engine
This is Rietveld 408576698