OLD | NEW |
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" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 ParsePictureHash(isolate, picture_handle); | 212 ParsePictureHash(isolate, picture_handle); |
213 if (!picture.get()) | 213 if (!picture.get()) |
214 return; | 214 return; |
215 | 215 |
216 gfx::Rect bounds = picture->LayerRect(); | 216 gfx::Rect bounds = picture->LayerRect(); |
217 SkDebugCanvas canvas(bounds.width(), bounds.height()); | 217 SkDebugCanvas canvas(bounds.width(), bounds.height()); |
218 picture->Replay(&canvas); | 218 picture->Replay(&canvas); |
219 | 219 |
220 v8::Handle<v8::Array> result = v8::Array::New(isolate, canvas.getSize()); | 220 v8::Handle<v8::Array> result = v8::Array::New(isolate, canvas.getSize()); |
221 for (int i = 0; i < canvas.getSize(); ++i) { | 221 for (int i = 0; i < canvas.getSize(); ++i) { |
222 DrawType cmd_type = canvas.getDrawCommandAt(i)->getType(); | 222 SkDrawCommand::OpType cmd_type = canvas.getDrawCommandAt(i)->getType(); |
223 v8::Handle<v8::Object> cmd = v8::Object::New(isolate); | 223 v8::Handle<v8::Object> cmd = v8::Object::New(isolate); |
224 cmd->Set(v8::String::NewFromUtf8(isolate, "cmd_type"), | 224 cmd->Set(v8::String::NewFromUtf8(isolate, "cmd_type"), |
225 v8::Integer::New(isolate, cmd_type)); | 225 v8::Integer::New(isolate, cmd_type)); |
226 cmd->Set(v8::String::NewFromUtf8(isolate, "cmd_string"), | 226 cmd->Set(v8::String::NewFromUtf8(isolate, "cmd_string"), |
227 v8::String::NewFromUtf8( | 227 v8::String::NewFromUtf8( |
228 isolate, SkDrawCommand::GetCommandString(cmd_type))); | 228 isolate, SkDrawCommand::GetCommandString(cmd_type))); |
229 | 229 |
230 const SkTDArray<SkString*>* info = canvas.getCommandInfo(i); | 230 const SkTDArray<SkString*>* info = canvas.getCommandInfo(i); |
231 DCHECK(info); | 231 DCHECK(info); |
232 | 232 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 v8::Handle<v8::Object> result = v8::Object::New(isolate); | 298 v8::Handle<v8::Object> result = v8::Object::New(isolate); |
299 result->Set(v8::String::NewFromUtf8(isolate, "width"), | 299 result->Set(v8::String::NewFromUtf8(isolate, "width"), |
300 v8::Number::New(isolate, picture->LayerRect().width())); | 300 v8::Number::New(isolate, picture->LayerRect().width())); |
301 result->Set(v8::String::NewFromUtf8(isolate, "height"), | 301 result->Set(v8::String::NewFromUtf8(isolate, "height"), |
302 v8::Number::New(isolate, picture->LayerRect().height())); | 302 v8::Number::New(isolate, picture->LayerRect().height())); |
303 | 303 |
304 args->Return(result); | 304 args->Return(result); |
305 } | 305 } |
306 | 306 |
307 } // namespace content | 307 } // namespace content |
OLD | NEW |