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

Side by Side Diff: runtime/embedders/android/eventloop.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 | « runtime/embedders/android/eventloop.h ('k') | runtime/embedders/android/graphics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "jni/eventloop.h" 5 #include "embedders/android/eventloop.h"
6 #include "jni/log.h" 6 #include "embedders/android/log.h"
7 7
8 EventLoop::EventLoop(android_app* application) 8 EventLoop::EventLoop(android_app* application)
9 : enabled_(false), 9 : enabled_(false),
10 quit_(false), 10 quit_(false),
11 application_(application), 11 application_(application),
12 activity_handler_(NULL), 12 activity_handler_(NULL),
13 input_handler_(NULL) { 13 input_handler_(NULL) {
14 application_->onAppCmd = ActivityCallback; 14 application_->onAppCmd = ActivityCallback;
15 application_->onInputEvent = InputCallback; 15 application_->onInputEvent = InputCallback;
16 application_->userData = this; 16 application_->userData = this;
17 } 17 }
18 18
19 void EventLoop::Run(ActivityHandler* activity_handler, 19 void EventLoop::Run(ActivityHandler* activity_handler,
20 Context* context) { 20 Context* context) {
21 int32_t result; 21 int32_t result;
22 int32_t events; 22 int32_t events;
23 android_poll_source* source; 23 android_poll_source* source;
24 24
25 app_dummy(); 25 // TODO(vsm): We need to link in native_app_glue.
26 // app_dummy();
26 activity_handler_ = activity_handler; 27 activity_handler_ = activity_handler;
27 input_handler_ = context->input_handler; 28 input_handler_ = context->input_handler;
28 LOGI("Starting event loop"); 29 LOGI("Starting event loop");
29 while (true) { 30 while (true) {
30 // If not enabled, block on events. If enabled, don't block 31 // If not enabled, block on events. If enabled, don't block
31 // so we can do useful work in onStep. 32 // so we can do useful work in onStep.
32 while ((result = ALooper_pollAll(enabled_ ? 0 : -1, 33 while ((result = ALooper_pollAll(enabled_ ? 0 : -1,
33 NULL, 34 NULL,
34 &events, 35 &events,
35 reinterpret_cast<void**>(&source))) >= 0) { 36 reinterpret_cast<void**>(&source))) >= 0) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void EventLoop::ActivityCallback(android_app* application, int32_t command) { 139 void EventLoop::ActivityCallback(android_app* application, int32_t command) {
139 EventLoop* event_loop = reinterpret_cast<EventLoop*>(application->userData); 140 EventLoop* event_loop = reinterpret_cast<EventLoop*>(application->userData);
140 event_loop->ProcessActivityEvent(command); 141 event_loop->ProcessActivityEvent(command);
141 } 142 }
142 143
143 int32_t EventLoop::InputCallback(android_app* application, 144 int32_t EventLoop::InputCallback(android_app* application,
144 AInputEvent* event) { 145 AInputEvent* event) {
145 EventLoop* event_loop = reinterpret_cast<EventLoop*>(application->userData); 146 EventLoop* event_loop = reinterpret_cast<EventLoop*>(application->userData);
146 return event_loop->ProcessInputEvent(event); 147 return event_loop->ProcessInputEvent(event);
147 } 148 }
OLDNEW
« no previous file with comments | « runtime/embedders/android/eventloop.h ('k') | runtime/embedders/android/graphics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698