summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2016-01-20 10:26:25 +0200
committerBogDan Vatra <bogdan@kdab.com>2016-01-23 14:53:51 +0000
commit550bf471b01b95098a376ec8534e0646f3f0c71f (patch)
tree5667b0948fbbb295252b0235d516bc1dafe48866
parent526479898eda860aea0ba5f738226b832b66f1fe (diff)
Use the new runOnAndroidThread method
Change-Id: I91eecb50faf2ee0cfafde5f71ea7a8541a7baadd Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
-rw-r--r--src/webview/qwebview_android.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/webview/qwebview_android.cpp b/src/webview/qwebview_android.cpp
index f5837bc..d47e61d 100644
--- a/src/webview/qwebview_android.cpp
+++ b/src/webview/qwebview_android.cpp
@@ -51,20 +51,6 @@
QT_BEGIN_NAMESPACE
-class SetClipBoundsRunnable : public QRunnable
-{
-public:
- SetClipBoundsRunnable(const QJNIObjectPrivate &view, const QRect &cr) : m_view(view), m_cr(cr) { }
- void run()
- {
- QJNIObjectPrivate cr("android/graphics/Rect", "(IIII)V", 0, 0, m_cr.width(), m_cr.height());
- m_view.callMethod<void>("setClipBounds", "(Landroid/graphics/Rect;)V", cr.object());
- }
-private:
- QJNIObjectPrivate m_view;
- const QRect m_cr;
-};
-
static inline bool setClipRect(const QJNIObjectPrivate &view, const QRect &clipRect)
{
if (QtAndroidPrivate::androidSdkVersion() < 18)
@@ -73,8 +59,10 @@ static inline bool setClipRect(const QJNIObjectPrivate &view, const QRect &clipR
if (!view.isValid())
return false;
- SetClipBoundsRunnable *r = new SetClipBoundsRunnable(view, clipRect);
- QtAndroidPrivate::runOnUiThread(r, QJNIEnvironmentPrivate());
+ QtAndroidPrivate::runOnAndroidThread([view, clipRect] {
+ QJNIObjectPrivate cr("android/graphics/Rect", "(IIII)V", 0, 0, clipRect.width(), clipRect.height());
+ view.callMethod<void>("setClipBounds", "(Landroid/graphics/Rect;)V", cr.object());
+ }, QJNIEnvironmentPrivate());
return true;
}