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

Unified Diff: android_webview/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: Created 7 years, 11 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/view_renderer.cc
diff --git a/android_webview/browser/view_renderer.cc b/android_webview/browser/view_renderer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f89462aab949cc27488c6dc99c814d820089e5b5
--- /dev/null
+++ b/android_webview/browser/view_renderer.cc
@@ -0,0 +1,45 @@
+// 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/view_renderer.h"
+
+#include "android_webview/public/browser/draw_sw.h"
+#include "base/logging.h"
+#include "third_party/skia/include/core/SkGraphics.h"
+
+namespace {
+AwDrawSWFunctionTable* g_sw_draw_functions = NULL;
+bool g_is_skia_version_compatible = false;
benm (inactive) 2013/01/21 20:34:49 nit: maybe a comment to explain about skia compati
Leandro Graciá Gil 2013/01/22 08:18:46 Done.
+}
+
+namespace android_webview {
+
+ViewRenderer::ViewRenderer(Client* client, JavaHelper* java_helper)
+ : client_(client),
+ java_helper_(java_helper) {
+}
+
+ViewRenderer::~ViewRenderer() {
+}
+
+// static
+void ViewRenderer::SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table) {
+ g_sw_draw_functions = table;
+ g_is_skia_version_compatible =
+ g_sw_draw_functions->is_skia_version_compatible(&SkGraphics::GetVersion);
+ if (!g_is_skia_version_compatible)
+ LOG(WARNING) << "Skia native versions are not compatible.";
mkosiba (inactive) 2013/01/22 02:13:34 nit: maybe explain the impact ("..are not compatib
Leandro Graciá Gil 2013/01/22 08:18:46 Done.
+}
+
+// static
+AwDrawSWFunctionTable* ViewRenderer::SWDrawFunctions() {
+ return g_sw_draw_functions;
+}
+
+// static
+bool ViewRenderer::IsSkiaVersionCompatible() {
mkosiba (inactive) 2013/01/22 02:13:34 DCHECK(g_sw_draw_functions != NULL) ?
Leandro Graciá Gil 2013/01/22 08:18:46 Nope. It will be null for tests.
+ return g_is_skia_version_compatible;
+}
+
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698