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

Unified Diff: android_webview/browser/browser_view_renderer.cc

Issue 12041009: [Android WebView] Migrate the rendering code to a separate set of classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated and rebased. Created 7 years, 10 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/browser_view_renderer.cc
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8575821a45d685f70a7755b6c4b386ea0c53b064
--- /dev/null
+++ b/android_webview/browser/browser_view_renderer.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 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/browser_view_renderer.h"
+
+#include "android_webview/public/browser/draw_sw.h"
+#include "base/logging.h"
+#include "third_party/skia/include/core/SkGraphics.h"
+
+namespace {
+
+// Provides software rendering functions from the Android glue layer.
+// Allows preventing extra copies of data when rendering.
+AwDrawSWFunctionTable* g_sw_draw_functions = NULL;
+
+// Tells if the Skia library versions in Android and Chromium are compatible.
+// If they are then it's possible to pass Skia objects like SkPictures to the
+// Android glue layer via the SW rendering functions.
+// If they are not, then additional copies and rasterizations are required
+// as a fallback mechanism, which will have an important performance impact.
+bool g_is_skia_version_compatible = false;
+
+}
+
+namespace android_webview {
+
+BrowserViewRenderer::BrowserViewRenderer(Client* client,
+ JavaHelper* java_helper)
+ : client_(client),
+ java_helper_(java_helper) {
+}
+
+BrowserViewRenderer::~BrowserViewRenderer() {
+}
+
+// static
+void BrowserViewRenderer::SetAwDrawSWFunctionTable(
+ AwDrawSWFunctionTable* table) {
+ g_sw_draw_functions = table;
+ g_is_skia_version_compatible =
+ g_sw_draw_functions->is_skia_version_compatible(&SkGraphics::GetVersion);
+ LOG_IF(WARNING, !g_is_skia_version_compatible)
+ << "Skia versions are not compatible, rendering performance will suffer.";
+}
+
+// static
+AwDrawSWFunctionTable* BrowserViewRenderer::SWDrawFunctions() {
+ return g_sw_draw_functions;
+}
+
+// static
+bool BrowserViewRenderer::IsSkiaVersionCompatible() {
+ return g_is_skia_version_compatible;
+}
+
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698