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

Unified Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 10823129: skia expects to be initialized before it can be used. This must be done if serializing SkPicture, w… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/gpu_benchmarking_extension.cc
===================================================================
--- content/renderer/gpu/gpu_benchmarking_extension.cc (revision 150362)
+++ content/renderer/gpu/gpu_benchmarking_extension.cc (working copy)
@@ -15,6 +15,7 @@
#include "content/renderer/render_view_impl.h"
#include "content/renderer/rendering_benchmark.h"
#include "content/renderer/rendering_benchmark_results.h"
+#include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h"
@@ -35,11 +36,24 @@
namespace {
+// Always called on the main render thread.
+// Does not need to be thread-safe.
+void InitSkGraphics() {
+ static bool init = false;
+ if (!init) {
+ SkGraphics::Init();
+ init = true;
+ }
+}
+
class SkPictureRecorder : public WebViewBenchmarkSupport::PaintClient {
public:
explicit SkPictureRecorder(const FilePath& dirpath)
: dirpath_(dirpath),
layer_id_(0) {
+ // Let skia register known effect subclasses. This basically enables
+ // reflection on those subclasses required for picture serialization.
+ InitSkGraphics();
}
virtual WebCanvas* willPaint(const WebSize& size) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698