Chromium Code Reviews| Index: runtime/embedders/openglui/common/vm_glue.cc |
| =================================================================== |
| --- runtime/embedders/openglui/common/vm_glue.cc (revision 18917) |
| +++ runtime/embedders/openglui/common/vm_glue.cc (working copy) |
| @@ -198,8 +198,10 @@ |
| return 0; |
| } |
| -int VMGlue::CallSetup() { |
| - if (!initialized_script_) { |
| +int VMGlue::CallSetup(bool force) { |
| + // TODO(gram): See if we actually need this flag guard here, or if |
| + // we can eliminate it along with the need for the force parameter. |
| + if (!initialized_script_ || force) { |
| initialized_script_ = true; |
| LOGI("Invoking setup(NULL, %d,%d)", surface_->width(), surface_->height()); |
| Dart_EnterIsolate(isolate_); |
| @@ -233,18 +235,32 @@ |
| int VMGlue::CallUpdate() { |
| if (initialized_script_) { |
| - LOGI("Invoking update"); |
| + // LOGI("Invoking update"); |
|
vsm
2013/02/23 00:25:25
Maybe these commented out LOGIs could just be dele
|
| Dart_EnterIsolate(isolate_); |
| Dart_EnterScope(); |
| int rtn = Invoke("update", 0, 0); |
| Dart_ExitScope(); |
| Dart_ExitIsolate(); |
| - LOGI("Done update"); |
| + // LOGI("Done update"); |
| return rtn; |
| } |
| return -1; |
| } |
| +int VMGlue::CallShutdown() { |
| + if (initialized_script_) { |
| + // LOGI("Invoking update"); |
| + Dart_EnterIsolate(isolate_); |
| + Dart_EnterScope(); |
| + int rtn = Invoke("shutdown", 0, 0); |
| + Dart_ExitScope(); |
| + Dart_ExitIsolate(); |
| + // LOGI("Done update"); |
| + return rtn; |
| + } |
| + return -1; |
| +} |
| + |
| int VMGlue::OnMotionEvent(const char* pFunction, int64_t pWhen, |
| float pMoveX, float pMoveY) { |
| if (initialized_script_) { |
| @@ -289,10 +305,10 @@ |
| int argc, |
| Dart_Handle* args, |
| bool failIfNotDefined) { |
| - LOGI("in invoke(%s)", function); |
| + // LOGI("in invoke(%s)", function); |
| // Lookup the library of the root script. |
| - LOGI("looking up the root library"); |
| + // LOGI("looking up the root library"); |
| Dart_Handle library = Dart_RootLibrary(); |
| if (Dart_IsNull(library)) { |
| LOGE("Unable to find root library\n"); |
| @@ -301,7 +317,7 @@ |
| Dart_Handle nameHandle = Dart_NewStringFromCString(function); |
| - LOGI("invoking %s", function); |
| + // LOGI("invoking %s", function); |
| Dart_Handle result = Dart_Invoke(library, nameHandle, argc, args); |
| if (Dart_IsError(result)) { |
| @@ -314,14 +330,14 @@ |
| // TODO(vsm): I don't think we need this. |
| // Keep handling messages until the last active receive port is closed. |
| - LOGI("Entering Dart message loop"); |
| + // LOGI("Entering Dart message loop"); |
| result = Dart_RunLoop(); |
| if (Dart_IsError(result)) { |
| LOGE("Dart_RunLoop: %s\n", Dart_GetError(result)); |
| return -1; |
| } |
| - LOGI("out invoke"); |
| + // LOGI("out invoke"); |
| return 0; |
| } |