OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gpu/gpu_benchmarking_extension.h" | 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "third_party/WebKit/public/web/WebView.h" | 25 #include "third_party/WebKit/public/web/WebView.h" |
26 #include "third_party/skia/include/core/SkData.h" | 26 #include "third_party/skia/include/core/SkData.h" |
27 #include "third_party/skia/include/core/SkGraphics.h" | 27 #include "third_party/skia/include/core/SkGraphics.h" |
28 #include "third_party/skia/include/core/SkPicture.h" | 28 #include "third_party/skia/include/core/SkPicture.h" |
29 #include "third_party/skia/include/core/SkPixelRef.h" | 29 #include "third_party/skia/include/core/SkPixelRef.h" |
30 #include "third_party/skia/include/core/SkStream.h" | 30 #include "third_party/skia/include/core/SkStream.h" |
31 #include "ui/gfx/codec/png_codec.h" | 31 #include "ui/gfx/codec/png_codec.h" |
32 #include "v8/include/v8.h" | 32 #include "v8/include/v8.h" |
33 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" | 33 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
34 | 34 |
35 using WebKit::WebCanvas; | 35 using blink::WebCanvas; |
36 using WebKit::WebFrame; | 36 using blink::WebFrame; |
37 using WebKit::WebImageCache; | 37 using blink::WebImageCache; |
38 using WebKit::WebPrivatePtr; | 38 using blink::WebPrivatePtr; |
39 using WebKit::WebRenderingStatsImpl; | 39 using blink::WebRenderingStatsImpl; |
40 using WebKit::WebSize; | 40 using blink::WebSize; |
41 using WebKit::WebView; | 41 using blink::WebView; |
42 | 42 |
43 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking"; | 43 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking"; |
44 | 44 |
45 static SkData* EncodeBitmapToData(size_t* offset, const SkBitmap& bm) { | 45 static SkData* EncodeBitmapToData(size_t* offset, const SkBitmap& bm) { |
46 SkPixelRef* pr = bm.pixelRef(); | 46 SkPixelRef* pr = bm.pixelRef(); |
47 if (pr != NULL) { | 47 if (pr != NULL) { |
48 SkData* data = pr->refEncodedData(); | 48 SkData* data = pr->refEncodedData(); |
49 if (data != NULL) { | 49 if (data != NULL) { |
50 *offset = bm.pixelRefOffset(); | 50 *offset = bm.pixelRefOffset(); |
51 return data; | 51 return data; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 new CallbackAndContext(args.GetIsolate(), | 481 new CallbackAndContext(args.GetIsolate(), |
482 callback_local, | 482 callback_local, |
483 context.web_frame()->mainWorldScriptContext()); | 483 context.web_frame()->mainWorldScriptContext()); |
484 | 484 |
485 int pixels_to_scroll = args[2]->IntegerValue(); | 485 int pixels_to_scroll = args[2]->IntegerValue(); |
486 | 486 |
487 int mouse_event_x = 0; | 487 int mouse_event_x = 0; |
488 int mouse_event_y = 0; | 488 int mouse_event_y = 0; |
489 | 489 |
490 if (arglen == 3) { | 490 if (arglen == 3) { |
491 WebKit::WebRect rect = context.render_view_impl()->windowRect(); | 491 blink::WebRect rect = context.render_view_impl()->windowRect(); |
492 mouse_event_x = rect.x + rect.width / 2; | 492 mouse_event_x = rect.x + rect.width / 2; |
493 mouse_event_y = rect.y + rect.height / 2; | 493 mouse_event_y = rect.y + rect.height / 2; |
494 } else { | 494 } else { |
495 if (arglen != 5 || | 495 if (arglen != 5 || |
496 !args[3]->IsNumber() || | 496 !args[3]->IsNumber() || |
497 !args[4]->IsNumber()) { | 497 !args[4]->IsNumber()) { |
498 args.GetReturnValue().Set(false); | 498 args.GetReturnValue().Set(false); |
499 return; | 499 return; |
500 } | 500 } |
501 | 501 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 690 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
691 args.GetReturnValue().Set(!!gpu_channel); | 691 args.GetReturnValue().Set(!!gpu_channel); |
692 } | 692 } |
693 }; | 693 }; |
694 | 694 |
695 v8::Extension* GpuBenchmarkingExtension::Get() { | 695 v8::Extension* GpuBenchmarkingExtension::Get() { |
696 return new GpuBenchmarkingWrapper(); | 696 return new GpuBenchmarkingWrapper(); |
697 } | 697 } |
698 | 698 |
699 } // namespace content | 699 } // namespace content |
OLD | NEW |