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

Unified Diff: runtime/embedders/openglui/common/dart_host.cc

Issue 11883013: Refactored OpenGL embedder that works on Android, Mac or Linux. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months 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
« no previous file with comments | « runtime/embedders/openglui/common/dart_host.h ('k') | runtime/embedders/openglui/common/events.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/embedders/openglui/common/dart_host.cc
===================================================================
--- runtime/embedders/openglui/common/dart_host.cc (revision 0)
+++ runtime/embedders/openglui/common/dart_host.cc (revision 0)
@@ -0,0 +1,126 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "embedders/openglui/common/dart_host.h"
+
+#include <math.h>
+#include <unistd.h>
+
+#include "embedders/openglui/common/log.h"
+
+DartHost::DartHost(Context *context)
+ : graphics_handler_(context->graphics_handler),
+ input_handler_(context->input_handler),
+ sound_handler_(context->sound_handler),
+ timer_(context->timer),
+ vm_glue_(context->vm_glue),
+ active_(false) {
+ LOGI("Creating DartHost");
+}
+
+DartHost::~DartHost() {
+ LOGI("Freeing DartHost");
+}
+
+int32_t DartHost::OnActivate() {
+ return Activate();
+}
+
+int32_t DartHost::Activate() {
+ if (!active_) {
+ LOGI("Activating DartHost");
+ if (graphics_handler_->Start() != 0) {
+ return -1;
+ }
+ if (sound_handler_->Start() != 0) {
+ return -1;
+ }
+ if (input_handler_->Start() != 0) {
+ return -1;
+ }
+ timer_->reset();
+ LOGI("Starting main isolate");
+ int result = vm_glue_->StartMainIsolate();
+ if (result != 0) {
+ LOGE("startMainIsolate returned %d", result);
+ return -1;
+ }
+ active_ = true;
+ vm_glue_->CallSetup();
+ }
+ return 0;
+}
+
+void DartHost::OnDeactivate() {
+ Deactivate();
+}
+
+void DartHost::Deactivate() {
+ if (active_) {
+ active_ = false;
+ vm_glue_->FinishMainIsolate();
+ LOGI("Deactivating DartHost");
+ input_handler_->Stop();
+ sound_handler_->Stop();
+ graphics_handler_->Stop();
+ }
+}
+
+int32_t DartHost::OnStep() {
+ timer_->update();
+ vm_glue_->CallUpdate();
+ if (graphics_handler_->Update() != 0) {
+ return -1;
+ }
+ return 0;
+}
+
+void DartHost::OnStart() {
+ LOGI("Starting DartHost");
+}
+
+void DartHost::OnResume() {
+ LOGI("Resuming DartHost");
+}
+
+void DartHost::OnPause() {
+ LOGI("Pausing DartHost");
+}
+
+void DartHost::OnStop() {
+ LOGI("Stopping DartHost");
+}
+
+void DartHost::OnDestroy() {
+ LOGI("Destroying DartHost");
+}
+
+void DartHost::OnSaveState(void** data, size_t* size) {
+ LOGI("Saving DartHost state");
+}
+
+void DartHost::OnConfigurationChanged() {
+ LOGI("DartHost config changed");
+}
+
+void DartHost::OnLowMemory() {
+ LOGI("DartHost low on memory");
+}
+
+void DartHost::OnCreateWindow() {
+ LOGI("DartHost creating window");
+}
+
+void DartHost::OnDestroyWindow() {
+ LOGI("DartHost destroying window");
+}
+
+void DartHost::OnGainedFocus() {
+ LOGI("DartHost gained focus");
+}
+
+void DartHost::OnLostFocus() {
+ LOGI("DartHost lost focus");
+}
+
« no previous file with comments | « runtime/embedders/openglui/common/dart_host.h ('k') | runtime/embedders/openglui/common/events.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698