| 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 "embedders/openglui/common/dart_host.h" | 5 #include "embedders/openglui/common/dart_host.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include "embedders/openglui/common/log.h" | 10 #include "embedders/openglui/common/log.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 LOGI("Activating DartHost"); | 32 LOGI("Activating DartHost"); |
| 33 if (graphics_handler_->Start() != 0) { | 33 if (graphics_handler_->Start() != 0) { |
| 34 return -1; | 34 return -1; |
| 35 } | 35 } |
| 36 if (sound_handler_->Start() != 0) { | 36 if (sound_handler_->Start() != 0) { |
| 37 return -1; | 37 return -1; |
| 38 } | 38 } |
| 39 if (input_handler_->Start() != 0) { | 39 if (input_handler_->Start() != 0) { |
| 40 return -1; | 40 return -1; |
| 41 } | 41 } |
| 42 timer_->reset(); | 42 timer_->Reset(); |
| 43 LOGI("Starting main isolate"); | 43 LOGI("Starting main isolate"); |
| 44 int result = vm_glue_->StartMainIsolate(); | 44 int result = vm_glue_->StartMainIsolate(); |
| 45 if (result != 0) { | 45 if (result != 0) { |
| 46 LOGE("startMainIsolate returned %d", result); | 46 LOGE("startMainIsolate returned %d", result); |
| 47 return -1; | 47 return -1; |
| 48 } | 48 } |
| 49 active_ = true; | 49 active_ = true; |
| 50 vm_glue_->CallSetup(); | 50 return vm_glue_->CallSetup(); |
| 51 } | 51 } |
| 52 return 0; | 52 return 0; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void DartHost::OnDeactivate() { | 55 void DartHost::OnDeactivate() { |
| 56 Deactivate(); | 56 Deactivate(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void DartHost::Deactivate() { | 59 void DartHost::Deactivate() { |
| 60 if (active_) { | 60 if (active_) { |
| 61 active_ = false; | 61 active_ = false; |
| 62 vm_glue_->FinishMainIsolate(); | 62 vm_glue_->FinishMainIsolate(); |
| 63 LOGI("Deactivating DartHost"); | 63 LOGI("Deactivating DartHost"); |
| 64 input_handler_->Stop(); | 64 input_handler_->Stop(); |
| 65 sound_handler_->Stop(); | 65 sound_handler_->Stop(); |
| 66 graphics_handler_->Stop(); | 66 graphics_handler_->Stop(); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 int32_t DartHost::OnStep() { | 70 int32_t DartHost::OnStep() { |
| 71 timer_->update(); | 71 timer_->Update(); |
| 72 vm_glue_->CallUpdate(); | 72 if (vm_glue_->CallUpdate() != 0 || |
| 73 if (graphics_handler_->Update() != 0) { | 73 graphics_handler_->Update() != 0) { |
| 74 return -1; | 74 return -1; |
| 75 } | 75 } |
| 76 return 0; | 76 return 0; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void DartHost::OnStart() { | 79 void DartHost::OnStart() { |
| 80 LOGI("Starting DartHost"); | 80 LOGI("Starting DartHost"); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void DartHost::OnResume() { | 83 void DartHost::OnResume() { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 void DartHost::OnGainedFocus() { | 119 void DartHost::OnGainedFocus() { |
| 120 LOGI("DartHost gained focus"); | 120 LOGI("DartHost gained focus"); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void DartHost::OnLostFocus() { | 123 void DartHost::OnLostFocus() { |
| 124 LOGI("DartHost lost focus"); | 124 LOGI("DartHost lost focus"); |
| 125 } | 125 } |
| 126 | 126 |
| OLD | NEW |