[email protected] | a822825 | 2013-05-14 11:10:05 | [diff] [blame] | 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. |
| 4 | |
| 5 | #ifndef CONTENT_RENDERER_SKIA_BENCHMARKING_EXTENSION_H_ |
| 6 | #define CONTENT_RENDERER_SKIA_BENCHMARKING_EXTENSION_H_ |
| 7 | |
[email protected] | cdb6b1e | 2014-01-23 00:06:49 | [diff] [blame] | 8 | #include "base/basictypes.h" |
| 9 | #include "gin/wrappable.h" |
| 10 | |
| 11 | namespace blink { |
| 12 | class WebFrame; |
| 13 | } |
| 14 | |
| 15 | namespace gin { |
| 16 | class Arguments; |
[email protected] | a822825 | 2013-05-14 11:10:05 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | namespace content { |
| 20 | |
[email protected] | cdb6b1e | 2014-01-23 00:06:49 | [diff] [blame] | 21 | class SkiaBenchmarking : public gin::Wrappable<SkiaBenchmarking> { |
[email protected] | a822825 | 2013-05-14 11:10:05 | [diff] [blame] | 22 | public: |
[email protected] | cdb6b1e | 2014-01-23 00:06:49 | [diff] [blame] | 23 | static gin::WrapperInfo kWrapperInfo; |
| 24 | static void Install(blink::WebFrame* frame); |
| 25 | |
| 26 | // Wrapper around SkGraphics::Init that can be invoked multiple times. |
| 27 | static void Initialize(); |
| 28 | |
| 29 | private: |
| 30 | SkiaBenchmarking(); |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 31 | ~SkiaBenchmarking() override; |
[email protected] | cdb6b1e | 2014-01-23 00:06:49 | [diff] [blame] | 32 | |
| 33 | // gin::Wrappable. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 34 | gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
mohan.reddy | ee0b42a | 2014-10-08 04:53:14 | [diff] [blame] | 35 | v8::Isolate* isolate) override; |
[email protected] | cdb6b1e | 2014-01-23 00:06:49 | [diff] [blame] | 36 | |
| 37 | // Rasterizes a Picture JSON-encoded by cc::Picture::AsValue(). |
| 38 | // |
| 39 | // Takes a JSON-encoded cc::Picture and optionally rasterization parameters: |
| 40 | // { |
| 41 | // 'scale': {Number}, |
| 42 | // 'stop': {Number}, |
| 43 | // 'overdraw': {Boolean}, |
| 44 | // 'clip': [Number, Number, Number, Number] |
| 45 | // } |
| 46 | // |
| 47 | // Returns |
| 48 | // { |
| 49 | // 'width': {Number}, |
| 50 | // 'height': {Number}, |
| 51 | // 'data': {ArrayBuffer} |
| 52 | // } |
| 53 | void Rasterize(gin::Arguments* args); |
| 54 | |
| 55 | // Extracts the Skia draw commands from a JSON-encoded cc::Picture. |
| 56 | // |
| 57 | // Takes a JSON-encoded cc::Picture and returns |
| 58 | // [{ 'cmd': {String}, 'info': [String, ...] }, ...] |
| 59 | void GetOps(gin::Arguments* args); |
| 60 | |
| 61 | // Returns timing information for the given picture. |
| 62 | // |
| 63 | // Takes a JSON-encoded cc::Picture and returns |
| 64 | // { 'total_time': {Number}, 'cmd_times': [Number, ...] } |
| 65 | void GetOpTimings(gin::Arguments* args); |
| 66 | |
| 67 | // Returns meta information for the given picture. |
| 68 | // |
| 69 | // Takes a base64 encoded SKP and returns |
| 70 | // { 'width': {Number}, 'height': {Number} } |
| 71 | void GetInfo(gin::Arguments* args); |
| 72 | |
| 73 | DISALLOW_COPY_AND_ASSIGN(SkiaBenchmarking); |
[email protected] | a822825 | 2013-05-14 11:10:05 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | } // namespace content |
| 77 | |
| 78 | #endif // CONTENT_RENDERER_SKIA_BENCHMARKING_EXTENSION_H_ |