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

Side by Side Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 2527833002: Implement SkEncodeImage() (Closed)
Patch Set: 2016-11-28 (Monday) 17:33:22 EST Created 4 years 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
« no previous file with comments | « no previous file | skia/BUILD.gn » ('j') | skia/BUILD.gn » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "third_party/skia/include/core/SkData.h" 44 #include "third_party/skia/include/core/SkData.h"
45 #include "third_party/skia/include/core/SkGraphics.h" 45 #include "third_party/skia/include/core/SkGraphics.h"
46 #include "third_party/skia/include/core/SkPicture.h" 46 #include "third_party/skia/include/core/SkPicture.h"
47 #include "third_party/skia/include/core/SkPictureRecorder.h" 47 #include "third_party/skia/include/core/SkPictureRecorder.h"
48 #include "third_party/skia/include/core/SkPixelRef.h" 48 #include "third_party/skia/include/core/SkPixelRef.h"
49 #include "third_party/skia/include/core/SkPixelSerializer.h" 49 #include "third_party/skia/include/core/SkPixelSerializer.h"
50 #include "third_party/skia/include/core/SkStream.h" 50 #include "third_party/skia/include/core/SkStream.h"
51 // Note that headers in third_party/skia/src are fragile. This is 51 // Note that headers in third_party/skia/src are fragile. This is
52 // an experimental, fragile, and diagnostic-only document type. 52 // an experimental, fragile, and diagnostic-only document type.
53 #include "third_party/skia/src/utils/SkMultiPictureDocument.h" 53 #include "third_party/skia/src/utils/SkMultiPictureDocument.h"
54 #include "ui/gfx/codec/install_skia_codec.h"
54 #include "ui/gfx/codec/png_codec.h" 55 #include "ui/gfx/codec/png_codec.h"
55 #include "v8/include/v8.h" 56 #include "v8/include/v8.h"
56 57
57 using blink::WebCanvas; 58 using blink::WebCanvas;
58 using blink::WebLocalFrame; 59 using blink::WebLocalFrame;
59 using blink::WebImageCache; 60 using blink::WebImageCache;
60 using blink::WebPrivatePtr; 61 using blink::WebPrivatePtr;
61 using blink::WebSize; 62 using blink::WebSize;
62 using blink::WebView; 63 using blink::WebView;
63 64
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 context.compositor()->SetRasterizeOnlyVisibleContent(); 588 context.compositor()->SetRasterizeOnlyVisibleContent();
588 } 589 }
589 590
590 void GpuBenchmarking::PrintPagesToSkPictures(v8::Isolate* isolate, 591 void GpuBenchmarking::PrintPagesToSkPictures(v8::Isolate* isolate,
591 const std::string& filename) { 592 const std::string& filename) {
592 PrintDocumentTofile(isolate, filename, &SkMakeMultiPictureDocument); 593 PrintDocumentTofile(isolate, filename, &SkMakeMultiPictureDocument);
593 } 594 }
594 595
595 void GpuBenchmarking::PrintPagesToXPS(v8::Isolate* isolate, 596 void GpuBenchmarking::PrintPagesToXPS(v8::Isolate* isolate,
596 const std::string& filename) { 597 const std::string& filename) {
597 PrintDocumentTofile(isolate, filename, 598 // SkXPS requires an image encoder be set up.
598 [](SkWStream* s) { return SkDocument::MakeXPS(s); }); 599 gfx::InstallCodecsIntoSkia();
600 PrintDocumentTofile(isolate, filename,
601 [](SkWStream* s) { return SkDocument::MakeXPS(s); });
599 } 602 }
600 603
601 void GpuBenchmarking::PrintToSkPicture(v8::Isolate* isolate, 604 void GpuBenchmarking::PrintToSkPicture(v8::Isolate* isolate,
602 const std::string& dirname) { 605 const std::string& dirname) {
603 GpuBenchmarkingContext context; 606 GpuBenchmarkingContext context;
604 if (!context.Init(true)) 607 if (!context.Init(true))
605 return; 608 return;
606 609
607 const cc::Layer* root_layer = context.compositor()->GetRootLayer(); 610 const cc::Layer* root_layer = context.compositor()->GetRootLayer();
608 if (!root_layer) 611 if (!root_layer)
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 &gpu_driver_bug_workarounds))) { 1045 &gpu_driver_bug_workarounds))) {
1043 return; 1046 return;
1044 } 1047 }
1045 1048
1046 v8::Local<v8::Value> result; 1049 v8::Local<v8::Value> result;
1047 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) 1050 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result))
1048 args->Return(result); 1051 args->Return(result);
1049 } 1052 }
1050 1053
1051 } // namespace content 1054 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | skia/BUILD.gn » ('j') | skia/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698