1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_SKIA_BENCHMARKING_EXTENSION_H_
6 #define CONTENT_RENDERER_SKIA_BENCHMARKING_EXTENSION_H_
8 #include "base/basictypes.h"
9 #include "gin/wrappable.h"
21 class SkiaBenchmarking
: public gin::Wrappable
<SkiaBenchmarking
> {
23 static gin::WrapperInfo kWrapperInfo
;
24 static void Install(blink::WebFrame
* frame
);
26 // Wrapper around SkGraphics::Init that can be invoked multiple times.
27 static void Initialize();
31 ~SkiaBenchmarking() override
;
34 gin::ObjectTemplateBuilder
GetObjectTemplateBuilder(
35 v8::Isolate
* isolate
) override
;
37 // Rasterizes a Picture JSON-encoded by cc::Picture::AsValue().
39 // Takes a JSON-encoded cc::Picture and optionally rasterization parameters:
43 // 'overdraw': {Boolean},
44 // 'clip': [Number, Number, Number, Number]
50 // 'height': {Number},
51 // 'data': {ArrayBuffer}
53 void Rasterize(gin::Arguments
* args
);
55 // Extracts the Skia draw commands from a JSON-encoded cc::Picture.
57 // Takes a JSON-encoded cc::Picture and returns
58 // [{ 'cmd': {String}, 'info': [String, ...] }, ...]
59 void GetOps(gin::Arguments
* args
);
61 // Returns timing information for the given picture.
63 // Takes a JSON-encoded cc::Picture and returns
64 // { 'total_time': {Number}, 'cmd_times': [Number, ...] }
65 void GetOpTimings(gin::Arguments
* args
);
67 // Returns meta information for the given picture.
69 // Takes a base64 encoded SKP and returns
70 // { 'width': {Number}, 'height': {Number} }
71 void GetInfo(gin::Arguments
* args
);
73 DISALLOW_COPY_AND_ASSIGN(SkiaBenchmarking
);
76 } // namespace content
78 #endif // CONTENT_RENDERER_SKIA_BENCHMARKING_EXTENSION_H_