Chromium Code Reviews| 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. | |
|
jamesr
2014/01/07 21:23:16
could you add a TODO with a link to a bug tracking
reed1
2014/01/07 21:28:31
Done.
| |
| 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) { |
|
jamesr
2014/01/07 21:23:16
remove the { }s as well since this is now a one-li
reed1
2014/01/07 21:28:31
Done.
| |
| 54 *offset = bm.pixelRefOffset(); | |
| 55 return data; | 56 return data; |
| 56 } | 57 } |
| 57 } | 58 } |
| 58 std::vector<unsigned char> vector; | 59 std::vector<unsigned char> vector; |
| 59 if (gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &vector)) { | 60 if (gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &vector)) { |
| 60 return SkData::NewWithCopy(&vector.front() , vector.size()); | 61 return SkData::NewWithCopy(&vector.front() , vector.size()); |
| 61 } | 62 } |
| 62 return NULL; | 63 return NULL; |
| 63 } | 64 } |
| 64 | 65 |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 846 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
| 846 args.GetReturnValue().Set(!!gpu_channel); | 847 args.GetReturnValue().Set(!!gpu_channel); |
| 847 } | 848 } |
| 848 }; | 849 }; |
| 849 | 850 |
| 850 v8::Extension* GpuBenchmarkingExtension::Get() { | 851 v8::Extension* GpuBenchmarkingExtension::Get() { |
| 851 return new GpuBenchmarkingWrapper(); | 852 return new GpuBenchmarkingWrapper(); |
| 852 } | 853 } |
| 853 | 854 |
| 854 } // namespace content | 855 } // namespace content |
| OLD | NEW |