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) { |