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

Side by Side Diff: samples/android_sample/jni/dart_host.cc

Issue 11467028: Migrate files to embedder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review fixes 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
« no previous file with comments | « samples/android_sample/jni/dart_host.h ('k') | samples/android_sample/jni/eventloop.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "jni/dart_host.h"
6
7 #include <math.h>
8 #include <unistd.h>
9
10 #include "jni/log.h"
11
12 DartHost::DartHost(Context *context)
13 : graphics_(context->graphics),
14 input_handler_(context->input_handler),
15 sound_service_(context->sound_service),
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_->Start() != 0) {
34 return -1;
35 }
36 if (sound_service_->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 sound_service_->Stop();
65 graphics_->Stop();
66 }
67 }
68
69 int32_t DartHost::OnStep() {
70 timer_->update();
71 vm_glue_->CallUpdate();
72 if (graphics_->Update() != 0) {
73 return -1;
74 }
75 return 0;
76 }
77
78 void DartHost::OnStart() {
79 LOGI("Starting DartHost");
80 }
81
82 void DartHost::OnResume() {
83 LOGI("Resuming DartHost");
84 }
85
86 void DartHost::OnPause() {
87 LOGI("Pausing DartHost");
88 }
89
90 void DartHost::OnStop() {
91 LOGI("Stopping DartHost");
92 }
93
94 void DartHost::OnDestroy() {
95 LOGI("Destroying DartHost");
96 }
97
98 void DartHost::OnSaveState(void** data, size_t size) {
99 LOGI("Saving DartHost state");
100 }
101
102 void DartHost::OnConfigurationChanged() {
103 LOGI("DartHost config changed");
104 }
105
106 void DartHost::OnLowMemory() {
107 LOGI("DartHost low on memory");
108 }
109
110 void DartHost::OnCreateWindow() {
111 LOGI("DartHost creating window");
112 }
113
114 void DartHost::OnDestroyWindow() {
115 LOGI("DartHost destroying window");
116 }
117
118 void DartHost::OnGainedFocus() {
119 LOGI("DartHost gained focus");
120 }
121
122 void DartHost::OnLostFocus() {
123 LOGI("DartHost lost focus");
124 }
125
126 void DartHost::Clear() {
127 memset(window_buffer_.bits, 0,
128 window_buffer_.stride * window_buffer_.height * sizeof(int32_t));
129 }
OLDNEW
« no previous file with comments | « samples/android_sample/jni/dart_host.h ('k') | samples/android_sample/jni/eventloop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698