| 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> |
| 11 #include <unistd.h> | 11 #include <unistd.h> |
| 12 | 12 |
| 13 #include "embedders/openglui/common/extension.h" | 13 #include "embedders/openglui/common/extension.h" |
| 14 #include "embedders/openglui/common/log.h" | 14 #include "embedders/openglui/common/log.h" |
| 15 #include "embedders/openglui/common/vm_glue.h" | 15 #include "embedders/openglui/common/vm_glue.h" |
| 16 #include "include/dart_api.h" | 16 #include "include/dart_api.h" |
| 17 | 17 |
| 18 char* VMGlue::extension_script_ = NULL; | 18 char* VMGlue::extension_script_ = NULL; |
| 19 bool VMGlue::initialized_vm_ = false; |
| 19 | 20 |
| 20 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise | 21 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise |
| 21 // it is initialized to NULL. | 22 // it is initialized to NULL. |
| 22 | 23 |
| 23 VMGlue::VMGlue(ISized* surface, | 24 VMGlue::VMGlue(ISized* surface, |
| 24 const char* script_path, | 25 const char* script_path, |
| 25 const char* extension_script, | 26 const char* extension_script, |
| 26 const char* main_script) | 27 const char* main_script) |
| 27 : surface_(surface), | 28 : surface_(surface), |
| 28 isolate_(NULL), | 29 isolate_(NULL), |
| 29 initialized_vm_(false), | |
| 30 initialized_script_(false) { | 30 initialized_script_(false) { |
| 31 LOGI("Creating VMGlue"); | 31 LOGI("Creating VMGlue"); |
| 32 if (main_script == NULL) { | 32 if (main_script == NULL) { |
| 33 main_script = "main.dart"; | 33 main_script = "main.dart"; |
| 34 } | 34 } |
| 35 if (extension_script == NULL) { | 35 if (extension_script == NULL) { |
| 36 extension_script = "gl.dart"; | 36 extension_script = "gl.dart"; |
| 37 } | 37 } |
| 38 size_t len = strlen(script_path) + strlen(main_script) + 2; | 38 size_t len = strlen(script_path) + strlen(main_script) + 2; |
| 39 main_script_ = new char[len]; | 39 main_script_ = new char[len]; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 void VMGlue::FinishMainIsolate() { | 336 void VMGlue::FinishMainIsolate() { |
| 337 LOGI("Finish main isolate"); | 337 LOGI("Finish main isolate"); |
| 338 Dart_EnterIsolate(isolate_); | 338 Dart_EnterIsolate(isolate_); |
| 339 // Shutdown the isolate. | 339 // Shutdown the isolate. |
| 340 Dart_ShutdownIsolate(); | 340 Dart_ShutdownIsolate(); |
| 341 isolate_ = NULL; | 341 isolate_ = NULL; |
| 342 initialized_script_ = false; | 342 initialized_script_ = false; |
| 343 } | 343 } |
| 344 | 344 |
| OLD | NEW |