diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-12-03 11:25:23 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-12-03 11:25:23 +0000 |
commit | 39df4898858bfeda9ceabc0c1524fb4406bc4e98 (patch) | |
tree | 3e1fd965ce7134d2d6d012c2cdf1fdb9c9106ba3 | |
parent | 9964a0bda0e13d265a092ba03963cd1820361769 (diff) | |
parent | 3c791cc22b289674702134029e06cd145f83730d (diff) | |
download | webview-39df4898858bfeda9ceabc0c1524fb4406bc4e98.tar.gz |
Update glue layer from master-chromium.
Pull in:
Fork draw_gl.h/draw_sw.h.
Wrap all of the WebView Contexts
to prepare for moving to a prebuilt.
-rw-r--r-- | chromium/Android.mk | 1 | ||||
-rw-r--r-- | chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java | 106 | ||||
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewChromium.java | 57 | ||||
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java | 11 | ||||
-rw-r--r-- | chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java | 28 | ||||
-rw-r--r-- | chromium/plat_support/draw_gl.h | 116 | ||||
-rw-r--r-- | chromium/plat_support/draw_gl_functor.cpp | 2 | ||||
-rw-r--r-- | chromium/plat_support/draw_sw.h | 66 | ||||
-rw-r--r-- | chromium/plat_support/graphic_buffer_impl.h | 2 | ||||
-rw-r--r-- | chromium/plat_support/graphics_utils.cpp | 4 |
10 files changed, 329 insertions, 64 deletions
diff --git a/chromium/Android.mk b/chromium/Android.mk index edcfdb2..b2d2cea 100644 --- a/chromium/Android.mk +++ b/chromium/Android.mk @@ -32,7 +32,6 @@ LOCAL_SRC_FILES:= \ plat_support/graphic_buffer_impl.cpp \ LOCAL_C_INCLUDES:= \ - $(CHROMIUM_PATH) \ external/skia/include/core \ frameworks/base/core/jni/android/graphics \ frameworks/native/include/ui \ diff --git a/chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java b/chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java new file mode 100644 index 0000000..da4174f --- /dev/null +++ b/chromium/java/com/android/webview/chromium/ResourcesContextWrapperFactory.java @@ -0,0 +1,106 @@ +/* + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.webview.chromium; + +import android.content.ComponentCallbacks; +import android.content.Context; +import android.content.ContextWrapper; +import android.content.res.AssetManager; +import android.content.res.Resources; +import android.view.LayoutInflater; + +import java.util.WeakHashMap; + +/** + * This class allows us to wrap the application context so that the WebView implementation can + * correctly reference both org.chromium.* and application classes which is necessary to properly + * inflate UI. We keep a weak map from contexts to wrapped contexts to avoid constantly re-wrapping + * or doubly wrapping contexts. + */ +public class ResourcesContextWrapperFactory { + private static WeakHashMap<Context,ContextWrapper> sCtxToWrapper + = new WeakHashMap<Context,ContextWrapper>(); + private static final Object sLock = new Object(); + + private ResourcesContextWrapperFactory() { + } + + public static Context get(Context ctx) { + ContextWrapper wrappedCtx; + synchronized (sLock) { + wrappedCtx = sCtxToWrapper.get(ctx); + if (wrappedCtx == null) { + wrappedCtx = createWrapper(ctx); + sCtxToWrapper.put(ctx, wrappedCtx); + } + } + return wrappedCtx; + } + + private static ContextWrapper createWrapper(final Context ctx) { + return new ContextWrapper(ctx) { + private Context applicationContext; + + @Override + public ClassLoader getClassLoader() { + final ClassLoader appCl = getBaseContext().getClassLoader(); + final ClassLoader webViewCl = this.getClass().getClassLoader(); + return new ClassLoader() { + @Override + protected Class<?> findClass(String name) throws ClassNotFoundException { + // First look in the WebViewProvider class loader. + try { + return webViewCl.loadClass(name); + } catch (ClassNotFoundException e) { + // Look in the app class loader; allowing it to throw ClassNotFoundException. + return appCl.loadClass(name); + } + } + }; + } + + @Override + public Object getSystemService(String name) { + if (Context.LAYOUT_INFLATER_SERVICE.equals(name)) { + LayoutInflater i = (LayoutInflater) getBaseContext().getSystemService(name); + return i.cloneInContext(this); + } else { + return getBaseContext().getSystemService(name); + } + } + + @Override + public Context getApplicationContext() { + if (applicationContext == null) + applicationContext = get(ctx.getApplicationContext()); + return applicationContext; + } + + @Override + public void registerComponentCallbacks(ComponentCallbacks callback) { + // We have to override registerComponentCallbacks and unregisterComponentCallbacks + // since they call getApplicationContext().[un]registerComponentCallbacks() + // which causes us to go into a loop. + ctx.registerComponentCallbacks(callback); + } + + @Override + public void unregisterComponentCallbacks(ComponentCallbacks callback) { + ctx.unregisterComponentCallbacks(callback); + } + }; + } +} diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java index 6e857db..ca82bb7 100644 --- a/chromium/java/com/android/webview/chromium/WebViewChromium.java +++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java @@ -17,10 +17,8 @@ package com.android.webview.chromium; import android.content.Context; -import android.content.ContextWrapper; import android.content.pm.PackageManager; import android.content.res.Configuration; -import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; @@ -39,7 +37,6 @@ import android.text.TextUtils; import android.util.Base64; import android.util.Log; import android.view.KeyEvent; -import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.View.MeasureSpec; @@ -138,6 +135,8 @@ class WebViewChromium implements WebViewProvider, WebView.PrivateAccess mWebViewPrivate; // The client adapter class. private WebViewContentsClientAdapter mContentsClientAdapter; + // The wrapped Context. + private Context mContext; // Variables for functionality provided by this adapter --------------------------------------- private ContentSettingsAdapter mWebSettings; @@ -164,7 +163,8 @@ class WebViewChromium implements WebViewProvider, mWebView = webView; mWebViewPrivate = webViewPrivate; mHitTestResult = new WebView.HitTestResult(); - mAppTargetSdkVersion = mWebView.getContext().getApplicationInfo().targetSdkVersion; + mContext = ResourcesContextWrapperFactory.get(mWebView.getContext()); + mAppTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; mFactory = factory; mRunQueue = new WebViewChromiumRunQueue(); factory.getWebViewDelegate().addWebViewAssetPath(mWebView.getContext()); @@ -219,8 +219,8 @@ class WebViewChromium implements WebViewProvider, throw new IllegalArgumentException(msg); } else { Log.w(TAG, msg); - TextView warningLabel = new TextView(mWebView.getContext()); - warningLabel.setText(mWebView.getContext().getString( + TextView warningLabel = new TextView(mContext); + warningLabel.setText(mContext.getString( R.string.webviewchromium_private_browsing_warning)); mWebView.addView(warningLabel); } @@ -245,9 +245,9 @@ class WebViewChromium implements WebViewProvider, mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT; mContentsClientAdapter = new WebViewContentsClientAdapter( - mWebView, mFactory.getWebViewDelegate()); + mWebView, mContext, mFactory.getWebViewDelegate()); mWebSettings = new ContentSettingsAdapter(new AwSettings( - mWebView.getContext(), isAccessFromFileURLsGrantedByDefault, + mContext, isAccessFromFileURLsGrantedByDefault, areLegacyQuirksEnabled)); if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) { @@ -272,43 +272,8 @@ class WebViewChromium implements WebViewProvider, }); } - // Wrap Context so that we can use resources from the webview resource apk. - private static Context resourcesContextWrapper(final Context ctx) { - return new ContextWrapper(ctx) { - @Override - public ClassLoader getClassLoader() { - final ClassLoader appCl = getBaseContext().getClassLoader(); - final ClassLoader webViewCl = this.getClass().getClassLoader(); - return new ClassLoader() { - @Override - protected Class<?> findClass(String name) throws ClassNotFoundException { - // First look in the WebViewProvider class loader. - try { - return webViewCl.loadClass(name); - } catch (ClassNotFoundException e) { - // Look in the app class loader; allowing it to throw ClassNotFoundException. - return appCl.loadClass(name); - } - } - }; - } - - @Override - public Object getSystemService(String name) { - if (name.equals(Context.LAYOUT_INFLATER_SERVICE)) { - LayoutInflater i = (LayoutInflater) getBaseContext().getSystemService(name); - return i.cloneInContext(this); - } else { - return getBaseContext().getSystemService(name); - } - } - - }; - } - private void initForReal() { - Context ctx = resourcesContextWrapper(mWebView.getContext()); - mAwContents = new AwContents(mFactory.getBrowserContext(), mWebView, ctx, + mAwContents = new AwContents(mFactory.getBrowserContext(), mWebView, mContext, new InternalAccessAdapter(), new WebViewNativeGLDelegate(), mContentsClientAdapter, mWebSettings.getAwSettings()); @@ -1261,7 +1226,7 @@ class WebViewChromium implements WebViewProvider, return false; } - FindActionModeCallback findAction = new FindActionModeCallback(mWebView.getContext()); + FindActionModeCallback findAction = new FindActionModeCallback(mContext); if (findAction == null) { return false; } @@ -1453,7 +1418,7 @@ class WebViewChromium implements WebViewProvider, // This was deprecated in 2009 and hidden in JB MR1, so just provide the minimum needed // to stop very out-dated applications from crashing. Log.w(TAG, "WebView doesn't support getZoomControls"); - return mAwContents.getSettings().supportZoom() ? new View(mWebView.getContext()) : null; + return mAwContents.getSettings().supportZoom() ? new View(mContext) : null; } @Override diff --git a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java index dc48b6e..5111105 100644 --- a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java +++ b/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java @@ -256,9 +256,10 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider { "/system/framework/webview/paks"); // Make sure that ResourceProvider is initialized before starting the browser process. - setUpResources(mWebViewDelegate.getApplication()); + Context context = getWrappedCurrentApplicationContext(); + setUpResources(context); initPlatSupportLibrary(); - AwBrowserProcess.start(mWebViewDelegate.getApplication()); + AwBrowserProcess.start(context); if (isBuildDebuggable()) { setWebContentsDebuggingEnabled(true); @@ -295,6 +296,10 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider { } } + private Context getWrappedCurrentApplicationContext() { + return ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplication()); + } + AwBrowserContext getBrowserContext() { synchronized (mLock) { return getBrowserContextLocked(); @@ -426,7 +431,7 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider { // will bring up just the parts it needs to make this work on a temporary // basis until Chromium is started for real. The temporary cookie manager // needs the application context to have been set. - ContentMain.initApplicationContext(mWebViewDelegate.getApplication()); + ContentMain.initApplicationContext(getWrappedCurrentApplicationContext()); } mCookieManager = new CookieManagerAdapter(new AwCookieManager()); } diff --git a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java index f3351c5..a08c457 100644 --- a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java +++ b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java @@ -99,6 +99,8 @@ public class WebViewContentsClientAdapter extends AwContentsClient { private static final boolean TRACE = false; // The WebView instance that this adapter is serving. private final WebView mWebView; + // The Context to use. This is different from mWebView.getContext(), which should not be used. + private final Context mContext; // The WebViewClient instance that was passed to WebView.setWebViewClient(). private WebViewClient mWebViewClient; // The WebChromeClient instance that was passed to WebView.setContentViewClient(). @@ -123,11 +125,17 @@ public class WebViewContentsClientAdapter extends AwContentsClient { * * @param webView the {@link WebView} instance that this adapter is serving. */ - WebViewContentsClientAdapter(WebView webView, WebViewDelegate webViewDelegate) { + WebViewContentsClientAdapter(WebView webView, Context context, + WebViewDelegate webViewDelegate) { if (webView == null || webViewDelegate == null) { - throw new IllegalArgumentException("webView or delegate can't be null"); + throw new IllegalArgumentException("webView or delegate can't be null."); } + if (context == null) { + throw new IllegalArgumentException("context can't be null."); + } + + mContext = context; mWebView = webView; mWebViewDelegate = webViewDelegate; setWebViewClient(null); @@ -535,7 +543,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { // ErrorStrings is @hidden, so we can't do this in AwContents. // Normally the net/ layer will set a valid description, but for synthesized callbacks // (like in the case for intercepted requests) AwContents will pass in null. - description = mWebViewDelegate.getErrorString(mWebView.getContext(), errorCode); + description = mWebViewDelegate.getErrorString(mContext, errorCode); } TraceEvent.begin(); if (TRACE) Log.d(TAG, "onReceivedError=" + failingUrl); @@ -693,7 +701,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { if (TRACE) Log.d(TAG, "onJsAlert"); if (!mWebChromeClient.onJsAlert(mWebView, url, message, res)) { new JsDialogHelper(res, JsDialogHelper.ALERT, null, message, url) - .showDialog(mWebView.getContext()); + .showDialog(mContext); } } else { receiver.cancel(); @@ -710,7 +718,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { if (TRACE) Log.d(TAG, "onJsBeforeUnload"); if (!mWebChromeClient.onJsBeforeUnload(mWebView, url, message, res)) { new JsDialogHelper(res, JsDialogHelper.UNLOAD, null, message, url) - .showDialog(mWebView.getContext()); + .showDialog(mContext); } } else { receiver.cancel(); @@ -727,7 +735,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { if (TRACE) Log.d(TAG, "onJsConfirm"); if (!mWebChromeClient.onJsConfirm(mWebView, url, message, res)) { new JsDialogHelper(res, JsDialogHelper.CONFIRM, null, message, url) - .showDialog(mWebView.getContext()); + .showDialog(mContext); } } else { receiver.cancel(); @@ -745,7 +753,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { if (TRACE) Log.d(TAG, "onJsPrompt"); if (!mWebChromeClient.onJsPrompt(mWebView, url, message, defaultValue, res)) { new JsDialogHelper(res, JsDialogHelper.PROMPT, defaultValue, message, url) - .showDialog(mWebView.getContext()); + .showDialog(mContext); } } else { receiver.cancel(); @@ -891,7 +899,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { } TraceEvent.begin(); FileChooserParamsAdapter adapter = new FileChooserParamsAdapter( - fileChooserParams, mWebView.getContext()); + fileChooserParams, mContext); if (TRACE) Log.d(TAG, "showFileChooser"); ValueCallback<Uri[]> callbackAdapter = new ValueCallback<Uri[]>() { private boolean mCompleted; @@ -920,7 +928,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { // If the app did not handle it and we are running on Lollipop or newer, then // abort. - if (mWebView.getContext().getApplicationInfo().targetSdkVersion >= + if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP) { uploadFileCallback.onReceiveValue(null); return; @@ -1000,7 +1008,7 @@ public class WebViewContentsClientAdapter extends AwContentsClient { // The ic_media_video_poster icon is transparent so we need to draw it on a gray // background. Bitmap poster = BitmapFactory.decodeResource( - mWebView.getContext().getResources(), + mContext.getResources(), R.drawable.ic_media_video_poster); result = Bitmap.createBitmap(poster.getWidth(), poster.getHeight(), poster.getConfig()); result.eraseColor(Color.GRAY); diff --git a/chromium/plat_support/draw_gl.h b/chromium/plat_support/draw_gl.h new file mode 100644 index 0000000..a60346f --- /dev/null +++ b/chromium/plat_support/draw_gl.h @@ -0,0 +1,116 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +//****************************************************************************** +// This is a copy of the coresponding android_webview/public/browser header. +// Any changes to the interface should be made there. +// +// The purpose of having the copy is twofold: +// - it removes the need to have Chromium sources present in the tree in order +// to build the plat_support library, +// - it captures API that the corresponding Android release supports. +//****************************************************************************** + +#ifndef ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_GL_H_ +#define ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_GL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +static const int kAwDrawGLInfoVersion = 1; + +// Holds the information required to trigger an OpenGL drawing operation. +struct AwDrawGLInfo { + int version; // The AwDrawGLInfo this struct was built with. + + // Input: tells the draw function what action to perform. + enum Mode { + kModeDraw = 0, + kModeProcess, + kModeProcessNoContext, + kModeSync, + } mode; + + // Input: current clip rect in surface coordinates. Reflects the current state + // of the OpenGL scissor rect. Both the OpenGL scissor rect and viewport are + // set by the caller of the draw function and updated during View animations. + int clip_left; + int clip_top; + int clip_right; + int clip_bottom; + + // Input: current width/height of destination surface. + int width; + int height; + + // Input: is the View rendered into an independent layer. + // If false, the surface is likely to hold to the full screen contents, with + // the scissor box set by the caller to the actual View location and size. + // Also the transformation matrix will contain at least a translation to the + // position of the View to render, plus any other transformations required as + // part of any ongoing View animation. View translucency (alpha) is ignored, + // although the framework will set is_layer to true for non-opaque cases. + // Can be requested via the View.setLayerType(View.LAYER_TYPE_NONE, ...) + // Android API method. + // + // If true, the surface is dedicated to the View and should have its size. + // The viewport and scissor box are set by the caller to the whole surface. + // Animation transformations are handled by the caller and not reflected in + // the provided transformation matrix. Translucency works normally. + // Can be requested via the View.setLayerType(View.LAYER_TYPE_HARDWARE, ...) + // Android API method. + bool is_layer; + + // Input: current transformation matrix in surface pixels. + // Uses the column-based OpenGL matrix format. + float transform[16]; +}; + +// Function to invoke a direct GL draw into the client's pre-configured +// GL context. Obtained via AwContents.getDrawGLFunction() (static). +// |view_context| is an opaque identifier that was returned by the corresponding +// call to AwContents.getAwDrawGLViewContext(). +// |draw_info| carries the in and out parameters for this draw. +// |spare| ignored; pass NULL. +typedef void (AwDrawGLFunction)(long view_context, + AwDrawGLInfo* draw_info, + void* spare); +enum AwMapMode { + MAP_READ_ONLY, + MAP_WRITE_ONLY, + MAP_READ_WRITE, +}; + +// Called to create a GraphicBuffer +typedef long AwCreateGraphicBufferFunction(int w, int h); +// Called to release a GraphicBuffer +typedef void AwReleaseGraphicBufferFunction(long buffer_id); +// Called to map a GraphicBuffer in |mode|. +typedef int AwMapFunction(long buffer_id, AwMapMode mode, void** vaddr); +// Called to unmap a GraphicBuffer +typedef int AwUnmapFunction(long buffer_id); +// Called to get a native buffer pointer +typedef void* AwGetNativeBufferFunction(long buffer_id); +// Called to get the stride of the buffer +typedef unsigned int AwGetStrideFunction(long buffer_id); + +static const int kAwDrawGLFunctionTableVersion = 1; + +// Set of functions used in rendering in hardware mode +struct AwDrawGLFunctionTable { + int version; + AwCreateGraphicBufferFunction* create_graphic_buffer; + AwReleaseGraphicBufferFunction* release_graphic_buffer; + AwMapFunction* map; + AwUnmapFunction* unmap; + AwGetNativeBufferFunction* get_native_buffer; + AwGetStrideFunction* get_stride; +}; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_GL_H_ diff --git a/chromium/plat_support/draw_gl_functor.cpp b/chromium/plat_support/draw_gl_functor.cpp index 03b6385..a7fbe5b 100644 --- a/chromium/plat_support/draw_gl_functor.cpp +++ b/chromium/plat_support/draw_gl_functor.cpp @@ -19,7 +19,7 @@ #define LOG_TAG "webviewchromium_plat_support" -#include "android_webview/public/browser/draw_gl.h" +#include "draw_gl.h" #include <errno.h> #include <jni.h> diff --git a/chromium/plat_support/draw_sw.h b/chromium/plat_support/draw_sw.h new file mode 100644 index 0000000..7423e13 --- /dev/null +++ b/chromium/plat_support/draw_sw.h @@ -0,0 +1,66 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +//****************************************************************************** +// This is a copy of the coresponding android_webview/public/browser header. +// Any changes to the interface should be made there. +// +// The purpose of having the copy is twofold: +// - it removes the need to have Chromium sources present in the tree in order +// to build the plat_support library, +// - it captures API that the corresponding Android release supports. +//****************************************************************************** + +#ifndef ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ +#define ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ + +#include <jni.h> +#include <stddef.h> + +#ifndef __cplusplus +#error "Can't mix C and C++ when using jni.h" +#endif + +class SkCanvasState; +class SkPicture; + +static const int kAwPixelInfoVersion = 3; + +// Holds the information required to implement the SW draw to system canvas. +struct AwPixelInfo { + int version; // The kAwPixelInfoVersion this struct was built with. + SkCanvasState* state; // The externalize state in skia format. + // NOTE: If you add more members, bump kAwPixelInfoVersion. +}; + +// Function that can be called to fish out the underlying native pixel data +// from a Java canvas object, for optimized rendering path. +// Returns the pixel info on success, which must be freed via a call to +// AwReleasePixelsFunction, or NULL. +typedef AwPixelInfo* (AwAccessPixelsFunction)(JNIEnv* env, jobject canvas); + +// Must be called to balance every *successful* call to AwAccessPixelsFunction +// (i.e. that returned true). +typedef void (AwReleasePixelsFunction)(AwPixelInfo* pixels); + +// Called to create an Android Picture object encapsulating a native SkPicture. +typedef jobject (AwCreatePictureFunction)(JNIEnv* env, SkPicture* picture); + +// Method that returns the current Skia function. +typedef void (SkiaVersionFunction)(int* major, int* minor, int* patch); + +// Called to verify if the Skia versions are compatible. +typedef bool (AwIsSkiaVersionCompatibleFunction)(SkiaVersionFunction function); + +static const int kAwDrawSWFunctionTableVersion = 1; + +// "vtable" for the functions declared in this file. An instance must be set via +// AwContents.setAwDrawSWFunctionTable +struct AwDrawSWFunctionTable { + int version; + AwAccessPixelsFunction* access_pixels; + AwReleasePixelsFunction* release_pixels; +}; + +#endif // ANDROID_WEBVIEW_PUBLIC_BROWSER_DRAW_SW_H_ diff --git a/chromium/plat_support/graphic_buffer_impl.h b/chromium/plat_support/graphic_buffer_impl.h index 5d5da12..442710a 100644 --- a/chromium/plat_support/graphic_buffer_impl.h +++ b/chromium/plat_support/graphic_buffer_impl.h @@ -22,7 +22,7 @@ #include <ui/GraphicBuffer.h> -#include "android_webview/public/browser/draw_gl.h" +#include "draw_gl.h" namespace android { diff --git a/chromium/plat_support/graphics_utils.cpp b/chromium/plat_support/graphics_utils.cpp index 320e419..c2017d3 100644 --- a/chromium/plat_support/graphics_utils.cpp +++ b/chromium/plat_support/graphics_utils.cpp @@ -19,8 +19,8 @@ #define LOG_TAG "webviewchromium_plat_support" -#include "android_webview/public/browser/draw_gl.h" -#include "android_webview/public/browser/draw_sw.h" +#include "draw_gl.h" +#include "draw_sw.h" #include <cstdlib> #include <jni.h> |