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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 fPThreadEnv->DeleteLocalRef(titleString); | 70 fPThreadEnv->DeleteLocalRef(titleString); |
71 } | 71 } |
72 | 72 |
73 void SkiaAndroidApp::paintIfNeeded() { | 73 void SkiaAndroidApp::paintIfNeeded() { |
74 if (fNativeWindow && fWindow) { | 74 if (fNativeWindow && fWindow) { |
75 fWindow->onPaint(); | 75 fWindow->onPaint(); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void SkiaAndroidApp::postMessage(const Message& message) const { | 79 void SkiaAndroidApp::postMessage(const Message& message) const { |
80 auto writeSize = write(fPipes[1], &message, sizeof(message)); | 80 SkAssertResult(write(fPipes[1], &message, sizeof(message)) == sizeof(message )); |
81 SkASSERT(writeSize == sizeof(message)); | |
82 } | 81 } |
83 | 82 |
84 void SkiaAndroidApp::readMessage(Message* message) const { | 83 void SkiaAndroidApp::readMessage(Message* message) const { |
85 auto readSize = read(fPipes[0], message, sizeof(Message)); | 84 SkAssertResult(read(fPipes[0], message, sizeof(Message)) == sizeof(Message)) ; |
egdaniel
2016/05/20 18:50:23
So just doing a fly by unsolicited review. Here wo
liyuqian
2016/05/20 18:53:00
That's a good point. However, I've already committ
| |
86 SkASSERT(readSize == sizeof(Message)); | |
87 } | 85 } |
88 | 86 |
89 void SkiaAndroidApp::inval() { | 87 void SkiaAndroidApp::inval() { |
90 SkAutoMutexAcquire ama(fMutex); | 88 SkAutoMutexAcquire ama(fMutex); |
91 if (!fIsContentInvalidated) { | 89 if (!fIsContentInvalidated) { |
92 postMessage(Message(kContentInvalidated)); | 90 postMessage(Message(kContentInvalidated)); |
93 fIsContentInvalidated = true; | 91 fIsContentInvalidated = true; |
94 } | 92 } |
95 } | 93 } |
96 | 94 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 auto skiaAndroidApp = (SkiaAndroidApp*)handle; | 237 auto skiaAndroidApp = (SkiaAndroidApp*)handle; |
240 Message message(kTouched); | 238 Message message(kTouched); |
241 message.fTouchOwner = owner; | 239 message.fTouchOwner = owner; |
242 message.fTouchState = state; | 240 message.fTouchState = state; |
243 message.fTouchX = x; | 241 message.fTouchX = x; |
244 message.fTouchY = y; | 242 message.fTouchY = y; |
245 skiaAndroidApp->postMessage(message); | 243 skiaAndroidApp->postMessage(message); |
246 } | 244 } |
247 | 245 |
248 } // namespace sk_app | 246 } // namespace sk_app |
OLD | NEW |