Merge "Apply changes to the WebView for compatibility with r5967 of Skia." into master-chromium
diff --git a/Source/WebCore/platform/graphics/android/layers/CanvasLayer.cpp b/Source/WebCore/platform/graphics/android/layers/CanvasLayer.cpp
index 4a7f161..1a51c4f 100644
--- a/Source/WebCore/platform/graphics/android/layers/CanvasLayer.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/CanvasLayer.cpp
@@ -121,7 +121,7 @@
 void CanvasLayer::canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect)
 {
     if (!m_texture->hasValidTexture()) {
-        // We only need to track invals if we aren't using a SurfaceTexture.
+        // We only need to track invals if we aren't using a GLConsumer.
         // If we drop out of hwa, we will do a full inval anyway
         SkIRect irect = SkIRect::MakeXYWH(changedRect.x(), changedRect.y(),
                                           changedRect.width(), changedRect.height());
diff --git a/Source/WebCore/platform/graphics/android/layers/CanvasTexture.cpp b/Source/WebCore/platform/graphics/android/layers/CanvasTexture.cpp
index aacb0bc..dca0dcd 100644
--- a/Source/WebCore/platform/graphics/android/layers/CanvasTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/CanvasTexture.cpp
@@ -41,7 +41,7 @@
 #include "SkPixelRef.h"
 
 #include <android/native_window.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 
 namespace WebCore {
@@ -107,8 +107,8 @@
         return 0;
     if (!useSurfaceTexture())
         return 0;
-    m_surfaceTexture = new android::SurfaceTexture(m_texture, false);
-    m_ANW = new android::SurfaceTextureClient(m_surfaceTexture);
+    m_surfaceTexture = new android::GLConsumer(m_texture, false);
+    m_ANW = new android::SurfaceTextureClient(m_surfaceTexture->getBufferQueue());
     int result = native_window_set_buffers_format(m_ANW.get(), HAL_PIXEL_FORMAT_RGBA_8888);
     GLUtils::checkSurfaceTextureError("native_window_set_buffers_format", result);
     if (result == NO_ERROR) {
diff --git a/Source/WebCore/platform/graphics/android/layers/CanvasTexture.h b/Source/WebCore/platform/graphics/android/layers/CanvasTexture.h
index 98962a0..f8c2f95 100644
--- a/Source/WebCore/platform/graphics/android/layers/CanvasTexture.h
+++ b/Source/WebCore/platform/graphics/android/layers/CanvasTexture.h
@@ -34,7 +34,7 @@
 #include <utils/threads.h>
 
 namespace android {
-class SurfaceTexture;
+class GLConsumer;
 class SurfaceTextureClient;
 }
 
@@ -81,7 +81,7 @@
     int m_layerId;
     GLuint m_texture;
     android::Mutex m_surfaceLock;
-    sp<android::SurfaceTexture> m_surfaceTexture;
+    sp<android::GLConsumer> m_surfaceTexture;
     sp<android::SurfaceTextureClient> m_ANW;
     bool m_hasValidTexture;
     bool m_useHwAcceleration;
diff --git a/Source/WebCore/platform/graphics/android/layers/MediaLayer.h b/Source/WebCore/platform/graphics/android/layers/MediaLayer.h
index 8e04681..188252b 100644
--- a/Source/WebCore/platform/graphics/android/layers/MediaLayer.h
+++ b/Source/WebCore/platform/graphics/android/layers/MediaLayer.h
@@ -24,7 +24,7 @@
 #include <jni.h>
 
 namespace android {
-    class SurfaceTexture;
+    class GLConsumer;
 }
 
 namespace WebCore {
@@ -47,7 +47,7 @@
     void invertContents(bool invert) { m_mediaTexture->invertContents(invert); }
     void setOutlineSize(int size) { m_outlineSize = size; }
 
-    // function to setup the primary SurfaceTexture in the renderer's context
+    // function to setup the primary SurfaceTextureClient in the renderer's context
     ANativeWindow* acquireNativeWindowForContent();
 
     // functions to manipulate secondary layers for video playback
@@ -60,7 +60,7 @@
     bool m_isCopy;
     int m_outlineSize;
 
-    // SurfaceTexture member variables
+    // SurfaceTextureClient member variables
     MediaTexture* m_mediaTexture;
 };
 
diff --git a/Source/WebCore/platform/graphics/android/layers/MediaListener.h b/Source/WebCore/platform/graphics/android/layers/MediaListener.h
index 2dfc08b..f02ff7c 100644
--- a/Source/WebCore/platform/graphics/android/layers/MediaListener.h
+++ b/Source/WebCore/platform/graphics/android/layers/MediaListener.h
@@ -19,7 +19,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 #include <jni.h>
 #include <JNIUtility.h>
@@ -28,11 +28,11 @@
 
 namespace WebCore {
 
-class MediaListener : public android::SurfaceTexture::FrameAvailableListener {
+class MediaListener : public android::GLConsumer::FrameAvailableListener {
 
 public:
     MediaListener(jobject weakWebViewRef,
-                  const sp<android::SurfaceTexture>& surfaceTexture,
+                  const sp<android::GLConsumer>& surfaceTexture,
                   const sp<ANativeWindow>& nativeWindow)
         : m_weakWebViewRef(weakWebViewRef)
         , m_postInvalMethod(0)
@@ -78,7 +78,7 @@
     jobject m_weakWebViewRef;
     jmethodID m_postInvalMethod;
     bool m_frameAvailable;
-    sp<android::SurfaceTexture> m_surfaceTexture;
+    sp<android::GLConsumer> m_surfaceTexture;
     sp<ANativeWindow> m_nativeWindow;
     FramerateCallbackProc m_framerateCallback;
 };
diff --git a/Source/WebCore/platform/graphics/android/layers/MediaTexture.cpp b/Source/WebCore/platform/graphics/android/layers/MediaTexture.cpp
index dffe6c2..67324c7 100644
--- a/Source/WebCore/platform/graphics/android/layers/MediaTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/MediaTexture.cpp
@@ -29,7 +29,7 @@
 #if USE(ACCELERATED_COMPOSITING)
 
 #include <android/native_window.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 #include <JNIUtility.h>
 #include "WebCoreJni.h"
@@ -280,8 +280,9 @@
 
     // populate the wrapper
     glGenTextures(1, &wrapper->textureId);
-    wrapper->surfaceTexture = new android::SurfaceTexture(wrapper->textureId);
-    wrapper->nativeWindow = new android::SurfaceTextureClient(wrapper->surfaceTexture);
+    wrapper->surfaceTexture = new android::GLConsumer(wrapper->textureId);
+    wrapper->nativeWindow = new android::SurfaceTextureClient(
+            wrapper->surfaceTexture->getBufferQueue());
     wrapper->dimensions.setEmpty();
 
     // setup callback
diff --git a/Source/WebCore/platform/graphics/android/layers/MediaTexture.h b/Source/WebCore/platform/graphics/android/layers/MediaTexture.h
index 9ea7be2..ad66f35 100644
--- a/Source/WebCore/platform/graphics/android/layers/MediaTexture.h
+++ b/Source/WebCore/platform/graphics/android/layers/MediaTexture.h
@@ -28,7 +28,7 @@
 #include <jni.h>
 
 namespace android {
-    class SurfaceTexture;
+    class GLConsumer;
 }
 
 namespace WebCore {
@@ -62,7 +62,7 @@
 private:
     struct TextureWrapper {
         GLuint textureId;
-        sp<android::SurfaceTexture> surfaceTexture;
+        sp<android::GLConsumer> surfaceTexture;
         sp<ANativeWindow> nativeWindow;
         sp<MediaListener> mediaListener;
         SkRect dimensions; // only used by the video layer
diff --git a/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.cpp
index 39bbec6..3593f88 100644
--- a/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.cpp
@@ -34,7 +34,7 @@
 #include "ShaderProgram.h"
 #include "TilesManager.h"
 #include <GLES2/gl2.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 
 #if USE(ACCELERATED_COMPOSITING)
 
@@ -62,7 +62,7 @@
 }
 
 // We can use this function to set the Layer to point to surface texture.
-void VideoLayerAndroid::setSurfaceTexture(sp<SurfaceTexture> texture,
+void VideoLayerAndroid::setSurfaceTexture(sp<GLConsumer> texture,
                                           int textureName, PlayerState playerState)
 {
     m_surfaceTexture = texture;
diff --git a/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.h
index 07c241f..1390ace 100644
--- a/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/VideoLayerAndroid.h
@@ -33,7 +33,7 @@
 #include <jni.h>
 
 namespace android {
-class SurfaceTexture;
+class GLConsumer;
 }
 
 namespace WebCore {
@@ -57,7 +57,7 @@
 
     // The following functions are called in UI thread only.
     virtual bool drawGL(bool layerTilesDisabled);
-    void setSurfaceTexture(sp<SurfaceTexture> texture, int textureName, PlayerState playerState);
+    void setSurfaceTexture(sp<GLConsumer> texture, int textureName, PlayerState playerState);
     virtual bool needsIsolatedSurface() { return true; }
 
 private:
@@ -67,7 +67,7 @@
     SkRect calVideoRect(const SkRect& rect);
     // Surface texture for showing the video is actually allocated in Java side
     // and passed into this native code.
-    sp<android::SurfaceTexture> m_surfaceTexture;
+    sp<android::GLConsumer> m_surfaceTexture;
 
     PlayerState m_playerState;
 
diff --git a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
index 1a54cb7..6e4b780 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
@@ -39,7 +39,7 @@
 #include "TransferQueue.h"
 
 #include <android/native_window.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <wtf/CurrentTime.h>
 
 // We will limit GL error logging for LOG_VOLUME_PER_CYCLE times every
diff --git a/Source/WebCore/platform/graphics/android/rendering/GLUtils.h b/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
index 3b093d1..86475f1 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
+++ b/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
@@ -40,7 +40,7 @@
 
 namespace android {
 
-class SurfaceTexture;
+class GLConsumer;
 
 } // namespace android
 
diff --git a/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp b/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp
index 8b5e30a..ed57613 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp
@@ -91,7 +91,7 @@
     GaneshContext::instance()->flush();
 
     // In SurfaceTextureMode we must call swapBuffers to unlock and post the
-    // tile's ANativeWindow (i.e. SurfaceTexture) buffer
+    // tile's ANativeWindow (i.e. SurfaceTextureClient) buffer
     TransferQueue* tileQueue = TilesManager::instance()->transferQueue();
     eglSwapBuffers(eglGetCurrentDisplay(), tileQueue->m_eglSurface);
     SkBitmap dummyBitmap;
diff --git a/Source/WebCore/platform/graphics/android/rendering/TextureInfo.cpp b/Source/WebCore/platform/graphics/android/rendering/TextureInfo.cpp
index f5c8b02..714410e 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TextureInfo.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TextureInfo.cpp
@@ -30,7 +30,7 @@
 
 #include <JNIUtility.h>
 #include <android/native_window.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 
 namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/android/rendering/TextureInfo.h b/Source/WebCore/platform/graphics/android/rendering/TextureInfo.h
index 7d182c3..077748e 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TextureInfo.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TextureInfo.h
@@ -34,7 +34,7 @@
 using android::sp;
 
 namespace android {
-class SurfaceTexture;
+class GLConsumer;
 }
 
 namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
index 50f862d..0ab74aa 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
@@ -42,7 +42,7 @@
 
 #include <android/native_window.h>
 #include <cutils/atomic.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 #include <wtf/CurrentTime.h>
 
diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp
index b15fa6d..0db91bd 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp
@@ -39,7 +39,7 @@
 #include "TileTexture.h"
 #include "TilesManager.h"
 #include <android/native_window.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 
 // For simple webView usage, MINIMAL_SIZE is recommended for memory saving.
@@ -106,14 +106,14 @@
         sp<BufferQueue> bufferQueue(new BufferQueue(true));
         m_sharedSurfaceTexture =
 #if GPU_UPLOAD_WITHOUT_DRAW
-            new android::SurfaceTexture(m_sharedSurfaceTextureId, true,
+            new android::GLConsumer(m_sharedSurfaceTextureId, true,
                                         GL_TEXTURE_2D, true, bufferQueue);
 #else
-            new android::SurfaceTexture(m_sharedSurfaceTextureId, true,
+            new android::GLConsumer(m_sharedSurfaceTextureId, true,
                                         GL_TEXTURE_EXTERNAL_OES, true,
                                         bufferQueue);
 #endif
-        m_ANW = new android::SurfaceTextureClient(m_sharedSurfaceTexture);
+        m_ANW = new android::SurfaceTextureClient(bufferQueue);
         m_sharedSurfaceTexture->setSynchronousMode(true);
 
         int extraBuffersNeeded = 0;
diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h
index 55011b0..d0d4a87 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h
@@ -188,7 +188,7 @@
     bool m_hasGLContext;
 
     GLState m_GLStateBeforeBlit;
-    android::sp<android::SurfaceTexture> m_sharedSurfaceTexture;
+    android::sp<android::GLConsumer> m_sharedSurfaceTexture;
 
     int m_emptyItemCount;
 
diff --git a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
index de91766..a2927ca 100644
--- a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
@@ -40,12 +40,12 @@
 #include <JNIHelp.h>
 #include <JNIUtility.h>
 #include <SkBitmap.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 
 using namespace android;
 // Forward decl
 namespace android {
-sp<SurfaceTexture> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz);
+sp<GLConsumer> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz);
 };
 
 namespace WebCore {
@@ -644,7 +644,7 @@
     if (!surfTex)
         return false;
 
-    sp<SurfaceTexture> texture = android::SurfaceTexture_getSurfaceTexture(env, surfTex);
+    sp<GLConsumer> texture = android::SurfaceTexture_getSurfaceTexture(env, surfTex);
     if (!texture.get())
         return false;
 
@@ -657,7 +657,7 @@
     if (!videoLayer)
         return false;
 
-    // Set the SurfaceTexture to the layer we found
+    // Set the GLConsumer to the layer we found
     videoLayer->setSurfaceTexture(texture, textureName, static_cast<PlayerState>(playerState));
     return true;
 }
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
index ecda831..9df4dbd 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -1103,7 +1103,9 @@
     pageClients.contextMenuClient = new ContextMenuClientAndroid;
     pageClients.editorClient = editorC;
     pageClients.dragClient = new DragClientAndroid;
+#if ENABLE(INSPECTOR)
     pageClients.inspectorClient = new InspectorClientAndroid;
+#endif
     pageClients.deviceMotionClient = deviceMotionC;
     pageClients.deviceOrientationClient = deviceOrientationC;
     pageClients.geolocationClient = geolocationC;