Commit c4d26d46 authored by alokp@chromium.org's avatar alokp@chromium.org

skia expects to be initialized before it can be used. This must be done if...

skia expects to be initialized before it can be used. This must be done if serializing SkPicture, which we now do for benchmarking.
Review URL: https://chromiumcodereview.appspot.com/10823129

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150609 0039d316-1c4b-4281-b951-d872f2087c98
parent 7babd1c9
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "content/renderer/render_view_impl.h" #include "content/renderer/render_view_impl.h"
#include "content/renderer/rendering_benchmark.h" #include "content/renderer/rendering_benchmark.h"
#include "content/renderer/rendering_benchmark_results.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/SkPicture.h"
#include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkStream.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h"
...@@ -35,11 +36,24 @@ const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking"; ...@@ -35,11 +36,24 @@ const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking";
namespace { 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 { class SkPictureRecorder : public WebViewBenchmarkSupport::PaintClient {
public: public:
explicit SkPictureRecorder(const FilePath& dirpath) explicit SkPictureRecorder(const FilePath& dirpath)
: dirpath_(dirpath), : dirpath_(dirpath),
layer_id_(0) { 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) { virtual WebCanvas* willPaint(const WebSize& size) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment