summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android_webview/lib/main/aw_main_delegate.cc9
-rw-r--r--android_webview/native/aw_contents.cc5
-rw-r--r--android_webview/renderer/aw_render_view_ext.cc33
-rw-r--r--android_webview/renderer/aw_render_view_ext.h7
-rw-r--r--content/public/renderer/render_view.h12
-rw-r--r--content/public/renderer/render_view_observer.h1
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc4
-rw-r--r--content/renderer/render_view_impl.cc12
-rw-r--r--content/renderer/render_view_impl.h4
-rw-r--r--content/renderer/render_widget.cc3
-rw-r--r--content/renderer/render_widget.h3
11 files changed, 56 insertions, 37 deletions
diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc
index 5c6399b..2a8954f 100644
--- a/android_webview/lib/main/aw_main_delegate.cc
+++ b/android_webview/lib/main/aw_main_delegate.cc
@@ -31,15 +31,6 @@ bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
// Set the command line to enable synchronous API compatibility.
command_line->AppendSwitch(switches::kEnableWebViewSynchronousAPIs);
- // TODO(leandrogracia): enable with the CapturePicture API support.
- if (false) {
- // Enable impl-side painting in the compositor.
- command_line->AppendSwitch(switches::kForceCompositingMode);
- command_line->AppendSwitch(switches::kEnableThreadedCompositing);
- command_line->AppendSwitch(switches::kEnableDeferredImageDecoding);
- command_line->AppendSwitch(cc::switches::kEnableImplSidePainting);
- }
-
return false;
}
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 1fd2ec1..eb2d6ec 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -554,9 +554,8 @@ void AwContents::Destroy(JNIEnv* env, jobject obj) {
void SetAwDrawSWFunctionTable(JNIEnv* env, jclass, jint function_table) {
g_draw_sw_functions =
reinterpret_cast<AwDrawSWFunctionTable*>(function_table);
- // TODO(leandrogracia): uncomment once the glue layer implements this method.
- //g_is_skia_version_compatible =
- // g_draw_sw_functions->is_skia_version_compatible(&SkGraphics::GetVersion);
+ g_is_skia_version_compatible =
+ g_draw_sw_functions->is_skia_version_compatible(&SkGraphics::GetVersion);
LOG_IF(WARNING, !g_is_skia_version_compatible) <<
"Skia native versions are not compatible.";
}
diff --git a/android_webview/renderer/aw_render_view_ext.cc b/android_webview/renderer/aw_render_view_ext.cc
index b381352..a193d89 100644
--- a/android_webview/renderer/aw_render_view_ext.cc
+++ b/android_webview/renderer/aw_render_view_ext.cc
@@ -15,6 +15,7 @@
#include "content/public/renderer/android_content_detection_prefixes.h"
#include "content/public/renderer/document_state.h"
#include "content/public/renderer/render_view.h"
+#include "skia/ext/refptr.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
@@ -27,6 +28,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
+#include "third_party/skia/include/core/SkPicture.h"
namespace android_webview {
@@ -127,18 +129,13 @@ void PopulateHitTestData(const GURL& absolute_link_url,
AwRenderViewExt::AwRenderViewExt(content::RenderView* render_view)
: content::RenderViewObserver(render_view) {
render_view->GetWebView()->setPermissionClient(this);
- // TODO(leandrogracia): enable once the feature is available in RenderView.
// TODO(leandrogracia): remove when SW rendering uses Ubercompositor.
// Until then we need the callback enabled for SW mode invalidation.
// http://crbug.com/170086.
- //render_view->SetCapturePictureCallback(
- // base::Bind(&AwRenderViewExt::OnPictureUpdate, AsWeakPtr()));
+ capture_picture_enabled_ = true;
}
AwRenderViewExt::~AwRenderViewExt() {
- // TODO(leandrogracia): enable once the feature is available in RenderView.
- //render_view()->SetCapturePictureCallback(
- // content::RenderView::CapturePictureCallback());
RendererPictureMap::GetInstance()->ClearRendererPicture(routing_id());
}
@@ -229,6 +226,15 @@ void AwRenderViewExt::FocusedNodeChanged(const WebKit::WebNode& node) {
Send(new AwViewHostMsg_UpdateHitTestData(routing_id(), data));
}
+void AwRenderViewExt::DidCommitCompositorFrame() {
+ if (!capture_picture_enabled_)
+ return;
+
+ skia::RefPtr<SkPicture> picture = render_view()->CapturePicture();
+ RendererPictureMap::GetInstance()->SetRendererPicture(routing_id(), picture);
+ Send(new AwViewHostMsg_PictureUpdated(routing_id()));
+}
+
void AwRenderViewExt::OnDoHitTest(int view_x, int view_y) {
if (!render_view() || !render_view()->GetWebView())
return;
@@ -251,21 +257,12 @@ void AwRenderViewExt::OnDoHitTest(int view_x, int view_y) {
}
void AwRenderViewExt::OnEnableCapturePictureCallback(bool enable) {
- // TODO(leandrogracia): enable once the feature is available in RenderView.
- //render_view()->SetCapturePictureCallback(enable ?
- // base::Bind(&AwRenderViewExt::OnPictureUpdate, AsWeakPtr()) :
- // content::RenderView::CapturePictureCallback());
-}
-
-void AwRenderViewExt::OnPictureUpdate(skia::RefPtr<SkPicture> picture) {
- RendererPictureMap::GetInstance()->SetRendererPicture(routing_id(), picture);
- Send(new AwViewHostMsg_PictureUpdated(routing_id()));
+ capture_picture_enabled_ = enable;
}
void AwRenderViewExt::OnCapturePictureSync() {
- // TODO(leandrogracia): enable once the feature is available in RenderView.
- //RendererPictureMap::GetInstance()->SetRendererPicture(
- // routing_id(), render_view()->CapturePicture());
+ RendererPictureMap::GetInstance()->SetRendererPicture(
+ routing_id(), render_view()->CapturePicture());
}
} // namespace android_webview
diff --git a/android_webview/renderer/aw_render_view_ext.h b/android_webview/renderer/aw_render_view_ext.h
index 8efa5b3..80b9d20 100644
--- a/android_webview/renderer/aw_render_view_ext.h
+++ b/android_webview/renderer/aw_render_view_ext.h
@@ -9,9 +9,7 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "content/public/renderer/render_view_observer.h"
-#include "skia/ext/refptr.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPermissionClient.h"
-#include "third_party/skia/include/core/SkPicture.h"
namespace WebKit {
@@ -42,6 +40,7 @@ class AwRenderViewExt : public content::RenderViewObserver,
virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
bool is_new_navigation) OVERRIDE;
virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE;
+ virtual void DidCommitCompositorFrame() OVERRIDE;
void OnDocumentHasImagesRequest(int id);
@@ -49,8 +48,6 @@ class AwRenderViewExt : public content::RenderViewObserver,
void OnEnableCapturePictureCallback(bool enable);
- void OnPictureUpdate(skia::RefPtr<SkPicture> picture);
-
void OnCapturePictureSync();
// WebKit::WebPermissionClient implementation.
@@ -58,6 +55,8 @@ class AwRenderViewExt : public content::RenderViewObserver,
bool enabledPerSettings,
const WebKit::WebURL& imageURL) OVERRIDE;
+ bool capture_picture_enabled_;
+
DISALLOW_COPY_AND_ASSIGN(AwRenderViewExt);
};
diff --git a/content/public/renderer/render_view.h b/content/public/renderer/render_view.h
index 5cf2af9..f60847b 100644
--- a/content/public/renderer/render_view.h
+++ b/content/public/renderer/render_view.h
@@ -9,10 +9,13 @@
#include "base/string16.h"
#include "content/common/content_export.h"
#include "ipc/ipc_sender.h"
+#include "skia/ext/refptr.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationPolicy.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageVisibilityState.h"
#include "ui/gfx/native_widget_types.h"
+class SkPicture;
+
namespace webkit_glue {
struct WebPreferences;
}
@@ -163,6 +166,15 @@ class CONTENT_EXPORT RenderView : public IPC::Sender {
// Returns a collection of security info about |frame|.
virtual SSLStatus GetSSLStatusOfFrame(WebKit::WebFrame* frame) const = 0;
+#if defined(OS_ANDROID)
+ // Returns a SkPicture with the full contents of the current frame as part of
+ // the legacy Android WebView capture picture API. As it involves playing back
+ // all the drawing commands of the current frame it can have an important
+ // performance impact and should not be used for other purposes.
+ // Requires enabling the impl-side painting feature in the compositor.
+ virtual skia::RefPtr<SkPicture> CapturePicture() = 0;
+#endif
+
protected:
virtual ~RenderView() {}
};
diff --git a/content/public/renderer/render_view_observer.h b/content/public/renderer/render_view_observer.h
index 48faa78..c6bd608 100644
--- a/content/public/renderer/render_view_observer.h
+++ b/content/public/renderer/render_view_observer.h
@@ -85,6 +85,7 @@ class CONTENT_EXPORT RenderViewObserver : public IPC::Listener,
virtual void DidRequestShowContextMenu(
WebKit::WebFrame* frame,
const WebKit::WebContextMenuData& data) {}
+ virtual void DidCommitCompositorFrame() {}
// These match the RenderView methods.
virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {}
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index 066f6e0..1dc83d4 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -359,9 +359,7 @@ void RenderWidgetCompositor::willCommit() {
}
void RenderWidgetCompositor::didCommit() {
- // TODO(jamesr): There is no chromium-side implementation of this first call,
- // remove if it's not needed.
- widget_->didCommitCompositorFrame();
+ widget_->DidCommitCompositorFrame();
widget_->didBecomeReadyForAdditionalInput();
}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 8dde7b7..e50cf13 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -27,6 +27,7 @@
#include "base/sys_string_conversions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
+#include "cc/layer_tree_host.h"
#include "cc/output_surface.h"
#include "cc/switches.h"
#include "content/common/appcache/appcache_dispatcher.h"
@@ -181,6 +182,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/default/WebRenderTheme.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkPicture.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/point.h"
@@ -6616,6 +6618,11 @@ bool RenderViewImpl::didTapMultipleTargets(
return true;
}
+
+skia::RefPtr<SkPicture> RenderViewImpl::CapturePicture() {
+ return compositor_ ? compositor_->layer_tree_host()->capturePicture() :
+ skia::RefPtr<SkPicture>();
+}
#endif
void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
@@ -6624,4 +6631,9 @@ void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
RenderProcess::current()->ReleaseTransportDIB(dib);
}
+void RenderViewImpl::DidCommitCompositorFrame() {
+ RenderWidget::DidCommitCompositorFrame();
+ FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame());
+}
+
} // namespace content
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 085478b..51c2d3e 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -728,6 +728,9 @@ class CONTENT_EXPORT RenderViewImpl
const std::string& value) OVERRIDE;
virtual void ClearEditCommands() OVERRIDE;
virtual SSLStatus GetSSLStatusOfFrame(WebKit::WebFrame* frame) const OVERRIDE;
+#if defined(OS_ANDROID)
+ virtual skia::RefPtr<SkPicture> CapturePicture() OVERRIDE;
+#endif
// webkit_glue::WebPluginPageDelegate implementation -------------------------
@@ -802,6 +805,7 @@ class CONTENT_EXPORT RenderViewImpl
virtual void GetCompositionCharacterBounds(
std::vector<gfx::Rect>* character_bounds) OVERRIDE;
virtual bool CanComposeInline() OVERRIDE;
+ virtual void DidCommitCompositorFrame() OVERRIDE;
protected:
explicit RenderViewImpl(RenderViewImplParams* params);
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 7fae491..51f2dbb 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1371,6 +1371,9 @@ void RenderWidget::didBecomeReadyForAdditionalInput() {
Send(pending_input_event_ack_.release());
}
+void RenderWidget::DidCommitCompositorFrame() {
+}
+
void RenderWidget::didCommitAndDrawCompositorFrame() {
TRACE_EVENT0("gpu", "RenderWidget::didCommitAndDrawCompositorFrame");
// Accelerated FPS tick for performance tests. See throughput_tests.cc.
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 725bdc5..1f35fb1 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -190,6 +190,9 @@ class CONTENT_EXPORT RenderWidget
// Close the underlying WebWidget.
virtual void Close();
+ // Notifies about a compositor frame commit operation having finished.
+ virtual void DidCommitCompositorFrame();
+
float filtered_time_per_frame() const {
return filtered_time_per_frame_;
}