summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2014-02-28 07:14:59 -0800
committerBo Liu <boliu@google.com>2014-03-03 13:05:59 -0800
commit7a63db1dc253badb616ca318e59f55580ae0b054 (patch)
tree5d0679ac66535442584676debf7a2d3de78484ef
parent4b2c8cb6870d1c665db98d18af953c47883551cf (diff)
downloadwebview-7a63db1dc253badb616ca318e59f55580ae0b054.tar.gz
Make executeHardwareAction avaiable to AwContents
Removed wrapping all of onDetachedFromWindow with executeHardwareAction, since upstream code will have finer control on what code to wrap executeHardwareAction in. Also take this opportunity to clean up native public interface. This is the first of a 3-sided patch. The upstream change is at https://codereview.chromium.org/185133003/ Change-Id: Ie0731a9546aefa7b195c9fd43bfc5c0a72745fd1
-rw-r--r--chromium/java/com/android/webview/chromium/WebViewChromium.java17
-rw-r--r--chromium/plat_support/draw_gl_functor.cpp23
-rw-r--r--chromium/plat_support/graphics_utils.cpp26
3 files changed, 7 insertions, 59 deletions
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java
index 38b27f7..b6ba34d 100644
--- a/chromium/java/com/android/webview/chromium/WebViewChromium.java
+++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java
@@ -1706,17 +1706,7 @@ class WebViewChromium implements WebViewProvider,
return;
}
- Runnable detachAwContents = new Runnable() {
- @Override
- public void run() {
- mAwContents.onDetachedFromWindow();
- }
- };
-
- if (mGLfunctor == null || !mWebView.executeHardwareAction(detachAwContents)) {
- detachAwContents.run();
- }
-
+ mAwContents.onDetachedFromWindow();
if (mGLfunctor != null) {
mGLfunctor.detach();
}
@@ -2117,5 +2107,10 @@ class WebViewChromium implements WebViewProvider,
}
return mGLfunctor.requestDrawGL((HardwareCanvas)canvas, mWebView.getViewRootImpl());
}
+
+ // @Override
+ public boolean executeHardwareAction(Runnable action) {
+ return mWebView.executeHardwareAction(action);
+ }
}
}
diff --git a/chromium/plat_support/draw_gl_functor.cpp b/chromium/plat_support/draw_gl_functor.cpp
index d83ead7..fd128eb 100644
--- a/chromium/plat_support/draw_gl_functor.cpp
+++ b/chromium/plat_support/draw_gl_functor.cpp
@@ -70,31 +70,10 @@ class DrawGLFunctor : public Functor {
aw_info.transform[i] = gl_info->transform[i];
}
- // Also pre-initialize the output fields in case the implementation does
- // not modify them.
- aw_info.status_mask = AwDrawGLInfo::kStatusMaskDone;
- aw_info.dirty_left = gl_info->dirtyLeft;
- aw_info.dirty_top = gl_info->dirtyTop;
- aw_info.dirty_right = gl_info->dirtyRight;
- aw_info.dirty_bottom = gl_info->dirtyBottom;
-
// Invoke the DrawGL method.
g_aw_drawgl_function(view_context_, &aw_info, NULL);
- // Copy out the outputs.
- gl_info->dirtyLeft = aw_info.dirty_left;
- gl_info->dirtyTop = aw_info.dirty_top;
- gl_info->dirtyRight = aw_info.dirty_right;
- gl_info->dirtyBottom = aw_info.dirty_bottom;
-
- // Calculate the return code.
- status_t res = DrawGlInfo::kStatusDone;
- if (aw_info.status_mask & AwDrawGLInfo::kStatusMaskDraw)
- res |= DrawGlInfo::kStatusDraw;
- if (aw_info.status_mask & AwDrawGLInfo::kStatusMaskInvoke)
- res |= DrawGlInfo::kStatusInvoke;
-
- return res;
+ return DrawGlInfo::kStatusDone;
}
private:
diff --git a/chromium/plat_support/graphics_utils.cpp b/chromium/plat_support/graphics_utils.cpp
index b02b87f..9b6758f 100644
--- a/chromium/plat_support/graphics_utils.cpp
+++ b/chromium/plat_support/graphics_utils.cpp
@@ -81,36 +81,10 @@ void ReleasePixels(AwPixelInfo* pixels) {
delete static_cast<PixelInfo*>(pixels);
}
-jobject CreatePicture(JNIEnv* env, SkPicture* picture) {
- jclass clazz = env->FindClass("android/graphics/Picture");
- jmethodID constructor = env->GetMethodID(clazz, "<init>", "(IZ)V");
- ALOG_ASSERT(clazz);
- ALOG_ASSERT(constructor);
- return env->NewObject(clazz, constructor, picture, false);
-}
-
-bool IsSkiaVersionCompatible(SkiaVersionFunction function) {
- bool compatible = false;
- if (function && function == &SkGraphics::GetVersion) {
- int android_major, android_minor, android_patch;
- SkGraphics::GetVersion(&android_major, &android_minor, &android_patch);
-
- int chromium_major, chromium_minor, chromium_patch;
- (*function)(&chromium_major, &chromium_minor, &chromium_patch);
-
- compatible = android_major == chromium_major &&
- android_minor == chromium_minor &&
- android_patch == chromium_patch;
- }
- return compatible;
-}
-
jint GetDrawSWFunctionTable(JNIEnv* env, jclass) {
static const AwDrawSWFunctionTable function_table = {
&GetPixels,
&ReleasePixels,
- &CreatePicture,
- &IsSkiaVersionCompatible,
};
return reinterpret_cast<jint>(&function_table);
}