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

Side by Side Diff: content/renderer/skia_benchmarking_extension.cc

Issue 149133005: Update callers of WebArrayBuffer/V8 conversions to use WebArrayBufferConverter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/skia_benchmarking_extension.h" 5 #include "content/renderer/skia_benchmarking_extension.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
11 #include "cc/resources/picture.h" 11 #include "cc/resources/picture.h"
12 #include "content/public/renderer/v8_value_converter.h" 12 #include "content/public/renderer/v8_value_converter.h"
13 #include "content/renderer/render_thread_impl.h" 13 #include "content/renderer/render_thread_impl.h"
14 #include "gin/arguments.h" 14 #include "gin/arguments.h"
15 #include "gin/handle.h" 15 #include "gin/handle.h"
16 #include "gin/object_template_builder.h" 16 #include "gin/object_template_builder.h"
17 #include "skia/ext/benchmarking_canvas.h" 17 #include "skia/ext/benchmarking_canvas.h"
18 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" 18 #include "third_party/WebKit/public/platform/WebArrayBuffer.h"
19 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h"
19 #include "third_party/WebKit/public/web/WebFrame.h" 20 #include "third_party/WebKit/public/web/WebFrame.h"
20 #include "third_party/WebKit/public/web/WebKit.h" 21 #include "third_party/WebKit/public/web/WebKit.h"
21 #include "third_party/skia/include/core/SkBitmapDevice.h" 22 #include "third_party/skia/include/core/SkBitmapDevice.h"
22 #include "third_party/skia/include/core/SkCanvas.h" 23 #include "third_party/skia/include/core/SkCanvas.h"
23 #include "third_party/skia/include/core/SkColorPriv.h" 24 #include "third_party/skia/include/core/SkColorPriv.h"
24 #include "third_party/skia/include/core/SkGraphics.h" 25 #include "third_party/skia/include/core/SkGraphics.h"
25 #include "third_party/skia/include/core/SkStream.h" 26 #include "third_party/skia/include/core/SkStream.h"
26 #include "third_party/skia/src/utils/debugger/SkDebugCanvas.h" 27 #include "third_party/skia/src/utils/debugger/SkDebugCanvas.h"
27 #include "third_party/skia/src/utils/debugger/SkDrawCommand.h" 28 #include "third_party/skia/src/utils/debugger/SkDrawCommand.h"
28 #include "ui/gfx/rect_conversions.h" 29 #include "ui/gfx/rect_conversions.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 buffer_pixels[i + 1] = SkGetPackedG32(c); 193 buffer_pixels[i + 1] = SkGetPackedG32(c);
193 buffer_pixels[i + 2] = SkGetPackedB32(c); 194 buffer_pixels[i + 2] = SkGetPackedB32(c);
194 buffer_pixels[i + 3] = SkGetPackedA32(c); 195 buffer_pixels[i + 3] = SkGetPackedA32(c);
195 } 196 }
196 197
197 v8::Handle<v8::Object> result = v8::Object::New(isolate); 198 v8::Handle<v8::Object> result = v8::Object::New(isolate);
198 result->Set(v8::String::NewFromUtf8(isolate, "width"), 199 result->Set(v8::String::NewFromUtf8(isolate, "width"),
199 v8::Number::New(isolate, snapped_clip.width())); 200 v8::Number::New(isolate, snapped_clip.width()));
200 result->Set(v8::String::NewFromUtf8(isolate, "height"), 201 result->Set(v8::String::NewFromUtf8(isolate, "height"),
201 v8::Number::New(isolate, snapped_clip.height())); 202 v8::Number::New(isolate, snapped_clip.height()));
202 result->Set(v8::String::NewFromUtf8(isolate, "data"), buffer.toV8Value()); 203 result->Set(v8::String::NewFromUtf8(isolate, "data"),
204 blink::WebArrayBufferConverter::toV8Value(&buffer));
203 205
204 args->Return(result); 206 args->Return(result);
205 } 207 }
206 208
207 void SkiaBenchmarking::GetOps(gin::Arguments* args) { 209 void SkiaBenchmarking::GetOps(gin::Arguments* args) {
208 v8::Isolate* isolate = args->isolate(); 210 v8::Isolate* isolate = args->isolate();
209 if (args->PeekNext().IsEmpty()) 211 if (args->PeekNext().IsEmpty())
210 return; 212 return;
211 v8::Handle<v8::Value> picture_handle; 213 v8::Handle<v8::Value> picture_handle;
212 args->GetNext(&picture_handle); 214 args->GetNext(&picture_handle);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 v8::Handle<v8::Object> result = v8::Object::New(isolate); 303 v8::Handle<v8::Object> result = v8::Object::New(isolate);
302 result->Set(v8::String::NewFromUtf8(isolate, "width"), 304 result->Set(v8::String::NewFromUtf8(isolate, "width"),
303 v8::Number::New(isolate, picture->LayerRect().width())); 305 v8::Number::New(isolate, picture->LayerRect().width()));
304 result->Set(v8::String::NewFromUtf8(isolate, "height"), 306 result->Set(v8::String::NewFromUtf8(isolate, "height"),
305 v8::Number::New(isolate, picture->LayerRect().height())); 307 v8::Number::New(isolate, picture->LayerRect().height()));
306 308
307 args->Return(result); 309 args->Return(result);
308 } 310 }
309 311
310 } // namespace content 312 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/v8_var_converter.cc ('k') | content/renderer/v8_value_converter_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698