| OLD | NEW |
| 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 <math.h> | 5 #include <math.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 args[2] = CheckError(Dart_NewDouble(pMoveY)); | 269 args[2] = CheckError(Dart_NewDouble(pMoveY)); |
| 270 int rtn = Invoke(pFunction, 3, args, false); | 270 int rtn = Invoke(pFunction, 3, args, false); |
| 271 Dart_ExitScope(); | 271 Dart_ExitScope(); |
| 272 Dart_ExitIsolate(); | 272 Dart_ExitIsolate(); |
| 273 LOGI("Done %s", pFunction); | 273 LOGI("Done %s", pFunction); |
| 274 return rtn; | 274 return rtn; |
| 275 } | 275 } |
| 276 return -1; | 276 return -1; |
| 277 } | 277 } |
| 278 | 278 |
| 279 int VMGlue::OnKeyEvent(const char* function, int64_t when, int32_t flags, | 279 int VMGlue::OnKeyEvent(const char* function, int64_t when, int32_t key_code, |
| 280 int32_t key_code, int32_t meta_state, int32_t repeat) { | 280 bool isAltKeyDown, bool isCtrlKeyDown, |
| 281 bool isShiftKeyDown, int32_t repeat) { |
| 281 if (initialized_script_) { | 282 if (initialized_script_) { |
| 282 LOGI("Invoking %s", function); | 283 LOGI("Invoking %s", function); |
| 283 Dart_EnterIsolate(isolate_); | 284 Dart_EnterIsolate(isolate_); |
| 284 Dart_EnterScope(); | 285 Dart_EnterScope(); |
| 285 Dart_Handle args[5]; | 286 Dart_Handle args[6]; |
| 286 args[0] = CheckError(Dart_NewInteger(when)); | 287 args[0] = CheckError(Dart_NewInteger(when)); |
| 287 args[1] = CheckError(Dart_NewInteger(flags)); | 288 args[1] = CheckError(Dart_NewInteger(key_code)); |
| 288 args[2] = CheckError(Dart_NewInteger(key_code)); | 289 args[2] = CheckError(Dart_NewBoolean(isAltKeyDown)); |
| 289 args[3] = CheckError(Dart_NewInteger(meta_state)); | 290 args[3] = CheckError(Dart_NewBoolean(isCtrlKeyDown)); |
| 290 args[4] = CheckError(Dart_NewInteger(repeat)); | 291 args[4] = CheckError(Dart_NewBoolean(isShiftKeyDown)); |
| 291 int rtn = Invoke(function, 5, args, false); | 292 args[5] = CheckError(Dart_NewInteger(repeat)); |
| 293 int rtn = Invoke(function, 6, args, false); |
| 292 Dart_ExitScope(); | 294 Dart_ExitScope(); |
| 293 Dart_ExitIsolate(); | 295 Dart_ExitIsolate(); |
| 294 LOGI("Done %s", function); | 296 LOGI("Done %s", function); |
| 295 return rtn; | 297 return rtn; |
| 296 } | 298 } |
| 297 return -1; | 299 return -1; |
| 298 } | 300 } |
| 299 | 301 |
| 300 int VMGlue::Invoke(const char* function, | 302 int VMGlue::Invoke(const char* function, |
| 301 int argc, | 303 int argc, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 335 |
| 334 void VMGlue::FinishMainIsolate() { | 336 void VMGlue::FinishMainIsolate() { |
| 335 LOGI("Finish main isolate"); | 337 LOGI("Finish main isolate"); |
| 336 Dart_EnterIsolate(isolate_); | 338 Dart_EnterIsolate(isolate_); |
| 337 // Shutdown the isolate. | 339 // Shutdown the isolate. |
| 338 Dart_ShutdownIsolate(); | 340 Dart_ShutdownIsolate(); |
| 339 isolate_ = NULL; | 341 isolate_ = NULL; |
| 340 initialized_script_ = false; | 342 initialized_script_ = false; |
| 341 } | 343 } |
| 342 | 344 |
| OLD | NEW |