diff options
4 files changed, 30 insertions, 59 deletions
diff --git a/android_webview/browser/aw_browser_main_parts.cc b/android_webview/browser/aw_browser_main_parts.cc index c8af525..6fa4f90 100644 --- a/android_webview/browser/aw_browser_main_parts.cc +++ b/android_webview/browser/aw_browser_main_parts.cc @@ -37,11 +37,10 @@ void AwBrowserMainParts::PreEarlyInitialization() { net::NetworkChangeNotifier::SetFactory( new net::NetworkChangeNotifierFactoryAndroid()); content::Compositor::InitializeWithFlags( - UseCompositorDirectDraw() ? - content::Compositor::DIRECT_CONTEXT_ON_DRAW_THREAD : 0); + content::Compositor::DIRECT_CONTEXT_ON_DRAW_THREAD); // Android WebView does not use default MessageLoop. It has its own - // Android specific MessageLoop. ALso see MainMessageLoopRun. + // Android specific MessageLoop. Also see MainMessageLoopRun. DCHECK(!main_message_loop_.get()); main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); MessageLoopForUI::current()->Start(); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java index 408c2d3..89f477e 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java @@ -36,8 +36,7 @@ import java.util.concurrent.TimeUnit; */ public class AndroidWebViewTestBase extends ActivityInstrumentationTestCase2<AndroidWebViewTestRunnerActivity> { - // TODO(boliu): Revert back to 15 seconds after crbug.com/167236 is fixed. - protected static int WAIT_TIMEOUT_SECONDS = 90; + protected static int WAIT_TIMEOUT_SECONDS = 15; private static final int CHECK_INTERVAL = 100; protected static final boolean NORMAL_VIEW = false; protected static final boolean INCOGNITO_VIEW = true; diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index 778400e..2343b6a 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc @@ -105,44 +105,6 @@ class AwContentsUserData : public base::SupportsUserData::Data { AwContents* contents_; }; -// Work-around for http://crbug.com/161864. TODO(joth): Remove this class when -// that bug is closed. -class NullCompositor : public content::Compositor { - public: - NullCompositor() {} - virtual ~NullCompositor() {} - - // Compositor - virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE {} - virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE {} - virtual void SetVisible(bool visible) OVERRIDE {} - virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE {} - virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect) - OVERRIDE { - return false; - } - virtual void Composite() {} - virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE { - return 0; - } - virtual WebKit::WebGLId GenerateCompressedTexture(gfx::Size& size, - int data_size, - void* data) OVERRIDE { - return 0; - } - virtual void DeleteTexture(WebKit::WebGLId texture_id) OVERRIDE {} - virtual bool CopyTextureToBitmap(WebKit::WebGLId texture_id, - gfx::JavaBitmap& bitmap) OVERRIDE { - return false; - } - virtual bool CopyTextureToBitmap(WebKit::WebGLId texture_id, - const gfx::Rect& src_rect, - gfx::JavaBitmap& bitmap) OVERRIDE { - return false; - } - virtual void SetHasTransparentBackground(bool flag) OVERRIDE {} -}; - } // namespace // static @@ -173,14 +135,9 @@ AwContents::AwContents(JNIEnv* env, } void AwContents::ResetCompositor() { - if (UseCompositorDirectDraw()) { - compositor_.reset(content::Compositor::Create(this)); - if (scissor_clip_layer_.get()) - AttachLayerTree(); - } else { - LOG(WARNING) << "Running on unsupported device: using null Compositor"; - compositor_.reset(new NullCompositor); - } + compositor_.reset(content::Compositor::Create(this)); + if (scissor_clip_layer_.get()) + AttachLayerTree(); } void AwContents::SetWebContents(content::WebContents* web_contents) { diff --git a/content/common/android/surface_texture_bridge.cc b/content/common/android/surface_texture_bridge.cc index bdf54ee..eb4b27e 100644 --- a/content/common/android/surface_texture_bridge.cc +++ b/content/common/android/surface_texture_bridge.cc @@ -6,6 +6,8 @@ #include <android/native_window_jni.h> +// TODO(boliu): Remove this include when we move off ICS. +#include "base/android/build_info.h" #include "base/android/jni_android.h" #include "base/logging.h" #include "content/common/android/surface_texture_listener.h" @@ -27,6 +29,16 @@ void RegisterNativesIfNeeded(JNIEnv* env) { g_jni_initialized = true; } } + +// TODO(boliu): Remove this method when when we move off ICS. See +// http://crbug.com/161864. +bool GlContextMethodsAvailable() { + bool available = base::android::BuildInfo::GetInstance()->sdk_int() >= 16; + if (!available) + LOG(WARNING) << "Running on unsupported device: rendering may not work"; + return available; +} + } // namespace namespace content { @@ -108,17 +120,21 @@ void SurfaceTextureBridge::SetDefaultBufferSize(int width, int height) { } void SurfaceTextureBridge::AttachToGLContext(int texture_id) { - JNIEnv* env = AttachCurrentThread(); - // Note: This method is only available on JB and greater. - JNI_SurfaceTexture::Java_SurfaceTexture_attachToGLContext( - env, j_surface_texture_.obj(), texture_id); + if (GlContextMethodsAvailable()) { + JNIEnv* env = AttachCurrentThread(); + // Note: This method is only available on JB and greater. + JNI_SurfaceTexture::Java_SurfaceTexture_attachToGLContext( + env, j_surface_texture_.obj(), texture_id); + } } void SurfaceTextureBridge::DetachFromGLContext() { - JNIEnv* env = AttachCurrentThread(); - // Note: This method is only available on JB and greater. - JNI_SurfaceTexture::Java_SurfaceTexture_detachFromGLContext( - env, j_surface_texture_.obj()); + if (GlContextMethodsAvailable()) { + JNIEnv* env = AttachCurrentThread(); + // Note: This method is only available on JB and greater. + JNI_SurfaceTexture::Java_SurfaceTexture_detachFromGLContext( + env, j_surface_texture_.obj()); + } } ANativeWindow* SurfaceTextureBridge::CreateSurface() { |