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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 #include "embedders/openglui/common/dart_host.h"
6
7 #include <math.h>
8 #include <unistd.h>
9
10 #include "embedders/openglui/common/log.h"
11
12 DartHost::DartHost(Context *context)
13 : graphics_handler_(context->graphics_handler),
14 input_handler_(context->input_handler),
15 sound_handler_(context->sound_handler),
16 timer_(context->timer),
17 vm_glue_(context->vm_glue),
18 active_(false) {
19 LOGI("Creating DartHost");
20 }
21
22 DartHost::~DartHost() {
23 LOGI("Freeing DartHost");
24 }
25
26 int32_t DartHost::OnActivate() {
27 return Activate();
28 }
29
30 int32_t DartHost::Activate() {
31 if (!active_) {
32 LOGI("Activating DartHost");
33 if (graphics_handler_->Start() != 0) {
34 return -1;
35 }
36 if (sound_handler_->Start() != 0) {
37 return -1;
38 }
39 if (input_handler_->Start() != 0) {
40 return -1;
41 }
42 timer_->reset();
43 LOGI("Starting main isolate");
44 int result = vm_glue_->StartMainIsolate();
45 if (result != 0) {
46 LOGE("startMainIsolate returned %d", result);
47 return -1;
48 }
49 active_ = true;
50 vm_glue_->CallSetup();
51 }
52 return 0;
53 }
54
55 void DartHost::OnDeactivate() {
56 Deactivate();
57 }
58
59 void DartHost::Deactivate() {
60 if (active_) {
61 active_ = false;
62 vm_glue_->FinishMainIsolate();
63 LOGI("Deactivating DartHost");
64 input_handler_->Stop();
65 sound_handler_->Stop();
66 graphics_handler_->Stop();
67 }
68 }
69
70 int32_t DartHost::OnStep() {
71 timer_->update();
72 vm_glue_->CallUpdate();
73 if (graphics_handler_->Update() != 0) {
74 return -1;
75 }
76 return 0;
77 }
78
79 void DartHost::OnStart() {
80 LOGI("Starting DartHost");
81 }
82
83 void DartHost::OnResume() {
84 LOGI("Resuming DartHost");
85 }
86
87 void DartHost::OnPause() {
88 LOGI("Pausing DartHost");
89 }
90
91 void DartHost::OnStop() {
92 LOGI("Stopping DartHost");
93 }
94
95 void DartHost::OnDestroy() {
96 LOGI("Destroying DartHost");
97 }
98
99 void DartHost::OnSaveState(void** data, size_t* size) {
100 LOGI("Saving DartHost state");
101 }
102
103 void DartHost::OnConfigurationChanged() {
104 LOGI("DartHost config changed");
105 }
106
107 void DartHost::OnLowMemory() {
108 LOGI("DartHost low on memory");
109 }
110
111 void DartHost::OnCreateWindow() {
112 LOGI("DartHost creating window");
113 }
114
115 void DartHost::OnDestroyWindow() {
116 LOGI("DartHost destroying window");
117 }
118
119 void DartHost::OnGainedFocus() {
120 LOGI("DartHost gained focus");
121 }
122
123 void DartHost::OnLostFocus() {
124 LOGI("DartHost lost focus");
125 }
126
OLDNEW
« 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