diff options
author | Ben Murdoch <benm@google.com> | 2013-08-08 10:24:53 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-08-08 10:24:53 +0100 |
commit | bb1529ce867d8845a77ec7cdf3e3003ef1771a40 (patch) | |
tree | f78d0de03cc8aed1a934d921636a0beb8d164378 /android_webview | |
parent | c95505573d864f17cabf515e32f5b8e0831ae237 (diff) | |
download | chromium_org-bb1529ce867d8845a77ec7cdf3e3003ef1771a40.tar.gz |
Merge from Chromium at DEPS revision r216370
This commit was generated by merge_to_master.py.
Change-Id: I739228187a6f1df6c28c5761160e593a49891113
Diffstat (limited to 'android_webview')
15 files changed, 137 insertions, 11 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp index c2f23a3e56..237712ac84 100644 --- a/android_webview/android_webview.gyp +++ b/android_webview/android_webview.gyp @@ -111,6 +111,8 @@ 'browser/aw_download_manager_delegate.h', 'browser/aw_form_database_service.cc', 'browser/aw_form_database_service.h', + 'browser/aw_gl_surface.cc', + 'browser/aw_gl_surface.h', 'browser/aw_http_auth_handler_base.cc', 'browser/aw_http_auth_handler_base.h', 'browser/aw_javascript_dialog_manager.cc', diff --git a/android_webview/android_webview_common.target.darwin-arm.mk b/android_webview/android_webview_common.target.darwin-arm.mk index 57a845e362..5e3624e9d1 100644 --- a/android_webview/android_webview_common.target.darwin-arm.mk +++ b/android_webview/android_webview_common.target.darwin-arm.mk @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ android_webview/browser/aw_form_database_service.cc \ + android_webview/browser/aw_gl_surface.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.darwin-mips.mk b/android_webview/android_webview_common.target.darwin-mips.mk index 4c6073b789..c775bc53ef 100644 --- a/android_webview/android_webview_common.target.darwin-mips.mk +++ b/android_webview/android_webview_common.target.darwin-mips.mk @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ android_webview/browser/aw_form_database_service.cc \ + android_webview/browser/aw_gl_surface.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.darwin-x86.mk b/android_webview/android_webview_common.target.darwin-x86.mk index 0d4f41d38f..0044f93ba8 100644 --- a/android_webview/android_webview_common.target.darwin-x86.mk +++ b/android_webview/android_webview_common.target.darwin-x86.mk @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ android_webview/browser/aw_form_database_service.cc \ + android_webview/browser/aw_gl_surface.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.linux-arm.mk b/android_webview/android_webview_common.target.linux-arm.mk index 57a845e362..5e3624e9d1 100644 --- a/android_webview/android_webview_common.target.linux-arm.mk +++ b/android_webview/android_webview_common.target.linux-arm.mk @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ android_webview/browser/aw_form_database_service.cc \ + android_webview/browser/aw_gl_surface.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.linux-mips.mk b/android_webview/android_webview_common.target.linux-mips.mk index 4c6073b789..c775bc53ef 100644 --- a/android_webview/android_webview_common.target.linux-mips.mk +++ b/android_webview/android_webview_common.target.linux-mips.mk @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ android_webview/browser/aw_form_database_service.cc \ + android_webview/browser/aw_gl_surface.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/android_webview_common.target.linux-x86.mk b/android_webview/android_webview_common.target.linux-x86.mk index 0d4f41d38f..0044f93ba8 100644 --- a/android_webview/android_webview_common.target.linux-x86.mk +++ b/android_webview/android_webview_common.target.linux-x86.mk @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \ android_webview/browser/aw_devtools_delegate.cc \ android_webview/browser/aw_download_manager_delegate.cc \ android_webview/browser/aw_form_database_service.cc \ + android_webview/browser/aw_gl_surface.cc \ android_webview/browser/aw_http_auth_handler_base.cc \ android_webview/browser/aw_javascript_dialog_manager.cc \ android_webview/browser/aw_login_delegate.cc \ diff --git a/android_webview/browser/aw_gl_surface.cc b/android_webview/browser/aw_gl_surface.cc new file mode 100644 index 0000000000..5ff927284d --- /dev/null +++ b/android_webview/browser/aw_gl_surface.cc @@ -0,0 +1,48 @@ +// Copyright 2013 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. + +#include "android_webview/browser/aw_gl_surface.h" + +namespace android_webview { + +AwGLSurface::AwGLSurface() : fbo_(0) {} + +AwGLSurface::~AwGLSurface() {} + +void AwGLSurface::Destroy() { +} + +bool AwGLSurface::IsOffscreen() { + return false; +} + +unsigned int AwGLSurface::GetBackingFrameBufferObject() { + return fbo_; +} + +bool AwGLSurface::SwapBuffers() { + return true; +} + +gfx::Size AwGLSurface::GetSize() { + return gfx::Size(1, 1); +} + +void* AwGLSurface::GetHandle() { + return NULL; +} + +void* AwGLSurface::GetDisplay() { + return NULL; +} + +void AwGLSurface::SetBackingFrameBufferObject(unsigned int fbo) { + fbo_ = fbo; +} + +void AwGLSurface::ResetBackingFrameBufferObject() { + fbo_ = 0; +} + +} // namespace android_webview diff --git a/android_webview/browser/aw_gl_surface.h b/android_webview/browser/aw_gl_surface.h new file mode 100644 index 0000000000..99b8a1dd36 --- /dev/null +++ b/android_webview/browser/aw_gl_surface.h @@ -0,0 +1,42 @@ +// Copyright 2013 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. + +#ifndef ANDROID_WEBVIEW_BROWSER_AW_GL_SURFACE_H_ +#define ANDROID_WEBVIEW_BROWSER_AW_GL_SURFACE_H_ + +#include "ui/gl/gl_surface.h" + +namespace android_webview { + +// This surface is used to represent the underlying surface provided by the App +// inside a hardware draw. Note that offscreen contexts will not be using this +// GLSurface. +class GL_EXPORT AwGLSurface : public gfx::GLSurface { + public: + AwGLSurface(); + + // Implement GLSurface. + virtual void Destroy() OVERRIDE; + virtual bool IsOffscreen() OVERRIDE; + virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; + virtual bool SwapBuffers() OVERRIDE; + virtual gfx::Size GetSize() OVERRIDE; + virtual void* GetHandle() OVERRIDE; + virtual void* GetDisplay() OVERRIDE; + + void SetBackingFrameBufferObject(unsigned int fbo); + void ResetBackingFrameBufferObject(); + + protected: + virtual ~AwGLSurface(); + + private: + unsigned int fbo_; + + DISALLOW_COPY_AND_ASSIGN(AwGLSurface); +}; + +} // namespace android_webview + +#endif // ANDROID_WEBVIEW_BROWSER_AW_GL_SURFACE_H_ diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc index a714956e08..3e256804a4 100644 --- a/android_webview/browser/in_process_view_renderer.cc +++ b/android_webview/browser/in_process_view_renderer.cc @@ -6,6 +6,7 @@ #include <android/bitmap.h> +#include "android_webview/browser/aw_gl_surface.h" #include "android_webview/browser/scoped_app_gl_state_restore.h" #include "android_webview/common/aw_switches.h" #include "android_webview/public/browser/draw_gl.h" @@ -289,6 +290,19 @@ bool InProcessViewRenderer::OnDraw(jobject java_canvas, return result; } +bool InProcessViewRenderer::InitializeHwDraw() { + TRACE_EVENT0("android_webview", "InitializeHwDraw"); + DCHECK(!gl_surface_); + gl_surface_ = new AwGLSurface; + hardware_failed_ = !compositor_->InitializeHwDraw(gl_surface_); + hardware_initialized_ = true; + + if (hardware_failed_) + gl_surface_ = NULL; + + return !hardware_failed_; +} + void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { TRACE_EVENT0("android_webview", "InProcessViewRenderer::DrawGL"); DCHECK(visible_); @@ -309,13 +323,11 @@ void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { ScopedAllowGL allow_gl; if (attached_to_window_ && compositor_ && !hardware_initialized_) { - TRACE_EVENT0("android_webview", "InitializeHwDraw"); - hardware_failed_ = !compositor_->InitializeHwDraw(); - hardware_initialized_ = true; - last_egl_context_ = current_context; - - if (hardware_failed_) + if (InitializeHwDraw()) { + last_egl_context_ = current_context; + } else { return; + } } if (draw_info->mode == AwDrawGLInfo::kModeProcess) @@ -330,7 +342,6 @@ void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { TRACE_EVENT_INSTANT0( "android_webview", "EGLContextChanged", TRACE_EVENT_SCOPE_THREAD); } - last_egl_context_ = current_context; if (!compositor_) { TRACE_EVENT_INSTANT0( @@ -338,21 +349,26 @@ void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { return; } + DCHECK(gl_surface_); + gl_surface_->SetBackingFrameBufferObject( + state_restore.framebuffer_binding_ext()); + gfx::Transform transform; transform.matrix().setColMajorf(draw_info->transform); transform.Translate(scroll_at_start_of_frame_.x(), scroll_at_start_of_frame_.y()); - // TODO(joth): Check return value. - block_invalidates_ = true; gfx::Rect clip_rect(draw_info->clip_left, draw_info->clip_top, draw_info->clip_right - draw_info->clip_left, draw_info->clip_bottom - draw_info->clip_top); + block_invalidates_ = true; + // TODO(joth): Check return value. compositor_->DemandDrawHw(gfx::Size(draw_info->width, draw_info->height), transform, clip_rect, state_restore.stencil_enabled()); block_invalidates_ = false; + gl_surface_->ResetBackingFrameBufferObject(); UpdateCachedGlobalVisibleRect(); bool drew_full_visible_rect = clip_rect.Contains(cached_global_visible_rect_); @@ -554,6 +570,7 @@ void InProcessViewRenderer::OnDetachedFromWindow() { hardware_initialized_ = false; } + gl_surface_ = NULL; attached_to_window_ = false; } diff --git a/android_webview/browser/in_process_view_renderer.h b/android_webview/browser/in_process_view_renderer.h index 6e66a8441b..8bb2c60e7d 100644 --- a/android_webview/browser/in_process_view_renderer.h +++ b/android_webview/browser/in_process_view_renderer.h @@ -23,6 +23,8 @@ class SkCanvas; namespace android_webview { +class AwGLSurface; + // Provides RenderViewHost wrapper functionality for sending WebView-specific // IPC messages to the renderer and from there to WebKit. class InProcessViewRenderer : public BrowserViewRenderer, @@ -93,6 +95,8 @@ class InProcessViewRenderer : public BrowserViewRenderer, void NoLongerExpectsDrawGL(); + bool InitializeHwDraw(); + // For debug tracing or logging. Return the string representation of this // view renderer's state and the |draw_info| if provided. std::string ToString(AwDrawGLInfo* draw_info) const; @@ -127,6 +131,7 @@ class InProcessViewRenderer : public BrowserViewRenderer, bool attached_to_window_; bool hardware_initialized_; bool hardware_failed_; + scoped_refptr<AwGLSurface> gl_surface_; // Used only for detecting Android View System context changes. // Not to be used between draw calls. diff --git a/android_webview/browser/scoped_app_gl_state_restore.cc b/android_webview/browser/scoped_app_gl_state_restore.cc index cb8d128901..e0c8fed934 100644 --- a/android_webview/browser/scoped_app_gl_state_restore.cc +++ b/android_webview/browser/scoped_app_gl_state_restore.cc @@ -132,6 +132,7 @@ ScopedAppGLStateRestore::ScopedAppGLStateRestore(CallMode mode) : mode_(mode) { glGetIntegerv(GL_STENCIL_VALUE_MASK, &stencil_mask_); glGetIntegerv(GL_STENCIL_REF, &stencil_ref_); + glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &framebuffer_binding_ext_); if (!g_gl_max_texture_units) { glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &g_gl_max_texture_units); @@ -155,6 +156,7 @@ ScopedAppGLStateRestore::~ScopedAppGLStateRestore() { TRACE_EVENT0("android_webview", "AppGLStateRestore"); MakeAppContextCurrent(); + glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding_ext_); glBindBuffer(GL_ARRAY_BUFFER, vertex_array_buffer_binding_); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_buffer_binding_); diff --git a/android_webview/browser/scoped_app_gl_state_restore.h b/android_webview/browser/scoped_app_gl_state_restore.h index 7840fbf065..93b5ad51be 100644 --- a/android_webview/browser/scoped_app_gl_state_restore.h +++ b/android_webview/browser/scoped_app_gl_state_restore.h @@ -25,6 +25,7 @@ class ScopedAppGLStateRestore { ~ScopedAppGLStateRestore(); bool stencil_enabled() const { return stencil_test_; } + GLint framebuffer_binding_ext() const { return framebuffer_binding_ext_; } private: const CallMode mode_; @@ -83,6 +84,8 @@ class ScopedAppGLStateRestore { GLint stencil_mask_; GLint stencil_ref_; + GLint framebuffer_binding_ext_; + struct TextureBindings { GLint texture_2d; GLint texture_cube_map; diff --git a/android_webview/native/aw_autofill_manager_delegate.cc b/android_webview/native/aw_autofill_manager_delegate.cc index 3791122d5d..37640cb491 100644 --- a/android_webview/native/aw_autofill_manager_delegate.cc +++ b/android_webview/native/aw_autofill_manager_delegate.cc @@ -187,11 +187,12 @@ void AwAutofillManagerDelegate::ConfirmSaveCreditCard( NOTIMPLEMENTED(); } -void AwAutofillManagerDelegate::ShowAutocheckoutBubble( +bool AwAutofillManagerDelegate::ShowAutocheckoutBubble( const gfx::RectF& bounding_box, bool is_google_user, const base::Callback<void(autofill::AutocheckoutBubbleState)>& callback) { NOTIMPLEMENTED(); + return false; } void AwAutofillManagerDelegate::HideAutocheckoutBubble() { diff --git a/android_webview/native/aw_autofill_manager_delegate.h b/android_webview/native/aw_autofill_manager_delegate.h index 1292ccbd22..b39eb70ef6 100644 --- a/android_webview/native/aw_autofill_manager_delegate.h +++ b/android_webview/native/aw_autofill_manager_delegate.h @@ -73,7 +73,7 @@ class AwAutofillManagerDelegate const autofill::AutofillMetrics& metric_logger, const autofill::CreditCard& credit_card, const base::Closure& save_card_callback) OVERRIDE; - virtual void ShowAutocheckoutBubble( + virtual bool ShowAutocheckoutBubble( const gfx::RectF& bounds, bool is_google_user, const base::Callback<void( |