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 28 matching lines...) Expand all Loading... |
39 using blink::WebCanvas; | 39 using blink::WebCanvas; |
40 using blink::WebFrame; | 40 using blink::WebFrame; |
41 using blink::WebImageCache; | 41 using blink::WebImageCache; |
42 using blink::WebPrivatePtr; | 42 using blink::WebPrivatePtr; |
43 using blink::WebRenderingStatsImpl; | 43 using blink::WebRenderingStatsImpl; |
44 using blink::WebSize; | 44 using blink::WebSize; |
45 using blink::WebView; | 45 using blink::WebView; |
46 | 46 |
47 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking"; | 47 const char kGpuBenchmarkingExtensionName[] = "v8/GpuBenchmarking"; |
48 | 48 |
| 49 // offset parameter is deprecated/ignored, and will be remove from the |
| 50 // signature in a future skia release. <reed@google.com> |
49 static SkData* EncodeBitmapToData(size_t* offset, const SkBitmap& bm) { | 51 static SkData* EncodeBitmapToData(size_t* offset, const SkBitmap& bm) { |
50 SkPixelRef* pr = bm.pixelRef(); | 52 SkPixelRef* pr = bm.pixelRef(); |
51 if (pr != NULL) { | 53 if (pr != NULL) { |
52 SkData* data = pr->refEncodedData(); | 54 SkData* data = pr->refEncodedData(); |
53 if (data != NULL) { | 55 if (data != NULL) |
54 *offset = bm.pixelRefOffset(); | |
55 return data; | 56 return data; |
56 } | |
57 } | 57 } |
58 std::vector<unsigned char> vector; | 58 std::vector<unsigned char> vector; |
59 if (gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &vector)) { | 59 if (gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &vector)) { |
60 return SkData::NewWithCopy(&vector.front() , vector.size()); | 60 return SkData::NewWithCopy(&vector.front() , vector.size()); |
61 } | 61 } |
62 return NULL; | 62 return NULL; |
63 } | 63 } |
64 | 64 |
65 namespace { | 65 namespace { |
66 | 66 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 845 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
846 args.GetReturnValue().Set(!!gpu_channel); | 846 args.GetReturnValue().Set(!!gpu_channel); |
847 } | 847 } |
848 }; | 848 }; |
849 | 849 |
850 v8::Extension* GpuBenchmarkingExtension::Get() { | 850 v8::Extension* GpuBenchmarkingExtension::Get() { |
851 return new GpuBenchmarkingWrapper(); | 851 return new GpuBenchmarkingWrapper(); |
852 } | 852 } |
853 | 853 |
854 } // namespace content | 854 } // namespace content |
OLD | NEW |