Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1299)

Unified Diff: android_webview/browser/renderer_host/aw_render_view_host_ext.cc

Issue 14888002: Android WebView Merged-Thread Hardware Draw (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/renderer_host/aw_render_view_host_ext.cc
diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
index 09553087a57b56df86d5178dedc9d9f70817ad10..7472599e66ce2f6217beca40b022dfde8b042327 100644
--- a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
+++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
@@ -6,21 +6,28 @@
#include "android_webview/browser/aw_browser_context.h"
#include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h"
+#include "android_webview/common/aw_switches.h"
#include "android_webview/common/render_view_messages.h"
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/logging.h"
+#include "content/public/browser/android/content_view_core.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/frame_navigate_params.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositorInputHandler.h"
namespace android_webview {
-AwRenderViewHostExt::AwRenderViewHostExt(content::WebContents* contents)
+AwRenderViewHostExt::AwRenderViewHostExt(
+ AwRenderViewHostExtClient* client, content::WebContents* contents)
: content::WebContentsObserver(contents),
+ client_(client),
has_new_hit_test_data_(false) {
+ DCHECK(client_);
}
AwRenderViewHostExt::~AwRenderViewHostExt() {}
@@ -105,6 +112,10 @@ bool AwRenderViewHostExt::OnMessageReceived(const IPC::Message& message) {
OnDocumentHasImagesResponse)
IPC_MESSAGE_HANDLER(AwViewHostMsg_UpdateHitTestData,
OnUpdateHitTestData)
+ IPC_MESSAGE_HANDLER(AwViewHostMsg_DidActivateAcceleratedCompositing,
+ OnDidActivateAcceleratedCompositing)
+ IPC_MESSAGE_HANDLER(AwViewHostMsg_PageScaleFactorChanged,
+ OnPageScaleFactorChanged)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -131,4 +142,29 @@ void AwRenderViewHostExt::OnUpdateHitTestData(
has_new_hit_test_data_ = true;
}
+void AwRenderViewHostExt::OnDidActivateAcceleratedCompositing(
+ int input_handler_id) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoMergeUIAndRendererCompositorThreads)) {
+ return;
+ }
+
+ // This call is only meaningful and thread-safe when the UI and renderer
+ // compositor share the same thread. Any other case will likely yield
+ // terrible, terrible damage.
+ WebKit::WebCompositorInputHandler* input_handler =
+ WebKit::WebCompositorInputHandler::fromIdentifier(input_handler_id);
+ if (!input_handler)
+ return;
+
+ content::ContentViewCore* content_view_core
+ = content::ContentViewCore::FromWebContents(web_contents());
+ if (content_view_core)
+ content_view_core->SetInputHandler(input_handler);
+}
+
+void AwRenderViewHostExt::OnPageScaleFactorChanged(float page_scale_factor) {
+ client_->OnPageScaleFactorChanged(page_scale_factor);
+}
+
} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698