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

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 149440)
+++ content/renderer/gpu/gpu_benchmarking_extension.cc (working copy)
@@ -6,6 +6,7 @@
#include <string>
+#include "base/at_exit.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/memory/scoped_vector.h"
@@ -15,6 +16,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 +37,27 @@
namespace {
+void TermSkGraphics(void* /* unused */) {
+ SkGraphics::Term();
jamesr 2012/08/07 20:51:26 this doesn't appear to actually be related to SkGr
reed1 2012/08/07 21:14:52 Term() is useful if you're tracking memory leaks,
+}
+
+void InitSkGraphics() {
+ static bool init = false;
+ if (!init) {
jamesr 2012/08/07 20:51:26 do we only ever call this from one thread?
alokp 2012/08/08 17:24:34 Yes - added comment.
+ SkGraphics::Init();
+ base::AtExitManager::RegisterCallback(TermSkGraphics, NULL);
+ 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