| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "surface_glue_android.h" | 8 #include "surface_glue_android.h" |
| 9 | 9 |
| 10 #include <jni.h> | 10 #include <jni.h> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 void SkiaAndroidApp::readMessage(Message* message) const { | 85 void SkiaAndroidApp::readMessage(Message* message) const { |
| 86 SkDEBUGCODE(auto readSize =) read(fPipes[0], message, sizeof(Message)); | 86 SkDEBUGCODE(auto readSize =) read(fPipes[0], message, sizeof(Message)); |
| 87 SkASSERT(readSize == sizeof(Message)); | 87 SkASSERT(readSize == sizeof(Message)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 int SkiaAndroidApp::message_callback(int fd, int events, void* data) { | 90 int SkiaAndroidApp::message_callback(int fd, int events, void* data) { |
| 91 auto skiaAndroidApp = (SkiaAndroidApp*)data; | 91 auto skiaAndroidApp = (SkiaAndroidApp*)data; |
| 92 Message message; | 92 Message message; |
| 93 skiaAndroidApp->readMessage(&message); | 93 skiaAndroidApp->readMessage(&message); |
| 94 SkDebugf("message_callback %d", message.fType); | |
| 95 SkASSERT(message.fType != kUndefined); | 94 SkASSERT(message.fType != kUndefined); |
| 96 | 95 |
| 97 switch (message.fType) { | 96 switch (message.fType) { |
| 98 case kDestroyApp: { | 97 case kDestroyApp: { |
| 99 delete skiaAndroidApp; | 98 delete skiaAndroidApp; |
| 100 pthread_exit(nullptr); | 99 pthread_exit(nullptr); |
| 101 return 0; | 100 return 0; |
| 102 } | 101 } |
| 103 case kContentInvalidated: { | 102 case kContentInvalidated: { |
| 104 ((Window_android*)skiaAndroidApp->fWindow)->paintIfNeeded(); | 103 ((Window_android*)skiaAndroidApp->fWindow)->paintIfNeeded(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 const char* nameChars = env->GetStringUTFChars(stateName, nullptr); | 261 const char* nameChars = env->GetStringUTFChars(stateName, nullptr); |
| 263 const char* valueChars = env->GetStringUTFChars(stateValue, nullptr); | 262 const char* valueChars = env->GetStringUTFChars(stateValue, nullptr); |
| 264 message.stateName = new SkString(nameChars); | 263 message.stateName = new SkString(nameChars); |
| 265 message.stateValue = new SkString(valueChars); | 264 message.stateValue = new SkString(valueChars); |
| 266 skiaAndroidApp->postMessage(message); | 265 skiaAndroidApp->postMessage(message); |
| 267 env->ReleaseStringUTFChars(stateName, nameChars); | 266 env->ReleaseStringUTFChars(stateName, nameChars); |
| 268 env->ReleaseStringUTFChars(stateValue, valueChars); | 267 env->ReleaseStringUTFChars(stateValue, valueChars); |
| 269 } | 268 } |
| 270 | 269 |
| 271 } // namespace sk_app | 270 } // namespace sk_app |
| OLD | NEW |