| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Note that headers in third_party/skia/src are fragile. This is | 57 // Note that headers in third_party/skia/src are fragile. This is |
| 58 // an experimental, fragile, and diagnostic-only document type. | 58 // an experimental, fragile, and diagnostic-only document type. |
| 59 #include "third_party/skia/src/utils/SkMultiPictureDocument.h" | 59 #include "third_party/skia/src/utils/SkMultiPictureDocument.h" |
| 60 #include "ui/events/base_event_utils.h" | 60 #include "ui/events/base_event_utils.h" |
| 61 #include "ui/gfx/codec/png_codec.h" | 61 #include "ui/gfx/codec/png_codec.h" |
| 62 #include "v8/include/v8.h" | 62 #include "v8/include/v8.h" |
| 63 | 63 |
| 64 #if defined(OS_WIN) && !defined(NDEBUG) | 64 #if defined(OS_WIN) && !defined(NDEBUG) |
| 65 #include <XpsObjectModel.h> | 65 #include <XpsObjectModel.h> |
| 66 #include "base/win/scoped_comptr.h" | 66 #include "base/win/scoped_comptr.h" |
| 67 #include "skia/ext/skia_encode_image.h" | |
| 68 #include "ui/gfx/codec/skia_image_encoder_adapter.h" | |
| 69 #endif | 67 #endif |
| 70 | 68 |
| 71 using blink::WebCanvas; | 69 using blink::WebCanvas; |
| 72 using blink::WebLocalFrame; | 70 using blink::WebLocalFrame; |
| 73 using blink::WebImageCache; | 71 using blink::WebImageCache; |
| 74 using blink::WebPrivatePtr; | 72 using blink::WebPrivatePtr; |
| 75 using blink::WebSize; | 73 using blink::WebSize; |
| 76 using blink::WebView; | 74 using blink::WebView; |
| 77 | 75 |
| 78 namespace content { | 76 namespace content { |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 doc->close(); | 516 doc->close(); |
| 519 } | 517 } |
| 520 } | 518 } |
| 521 | 519 |
| 522 // This function is only used for correctness testing of this experimental | 520 // This function is only used for correctness testing of this experimental |
| 523 // feature; no need for it in release builds. | 521 // feature; no need for it in release builds. |
| 524 // Also note: You must execute Chrome with `--no-sandbox` and | 522 // Also note: You must execute Chrome with `--no-sandbox` and |
| 525 // `--enable-gpu-benchmarking` for this to work. | 523 // `--enable-gpu-benchmarking` for this to work. |
| 526 #if defined(OS_WIN) && !defined(NDEBUG) | 524 #if defined(OS_WIN) && !defined(NDEBUG) |
| 527 static sk_sp<SkDocument> MakeXPSDocument(SkWStream* s) { | 525 static sk_sp<SkDocument> MakeXPSDocument(SkWStream* s) { |
| 528 // Hand Skia an image encoder, needed for XPS backend. | |
| 529 skia::SetImageEncoder(&gfx::EncodeSkiaImage); | |
| 530 | |
| 531 // I am not sure why this hasn't been initialized yet. | 526 // I am not sure why this hasn't been initialized yet. |
| 532 (void)CoInitializeEx(nullptr, | 527 (void)CoInitializeEx(nullptr, |
| 533 COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); | 528 COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); |
| 534 // In non-sandboxed mode, we will need to create and hold on to the | 529 // In non-sandboxed mode, we will need to create and hold on to the |
| 535 // factory before entering the sandbox. | 530 // factory before entering the sandbox. |
| 536 base::win::ScopedComPtr<IXpsOMObjectFactory> factory; | 531 base::win::ScopedComPtr<IXpsOMObjectFactory> factory; |
| 537 HRESULT hr = factory.CreateInstance(CLSID_XpsOMObjectFactory, nullptr, | 532 HRESULT hr = factory.CreateInstance(CLSID_XpsOMObjectFactory, nullptr, |
| 538 CLSCTX_INPROC_SERVER); | 533 CLSCTX_INPROC_SERVER); |
| 539 if (FAILED(hr) || !factory) { | 534 if (FAILED(hr) || !factory) { |
| 540 LOG(ERROR) << "CoCreateInstance(CLSID_XpsOMObjectFactory, ...) failed:" | 535 LOG(ERROR) << "CoCreateInstance(CLSID_XpsOMObjectFactory, ...) failed:" |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 &gpu_driver_bug_workarounds))) { | 1132 &gpu_driver_bug_workarounds))) { |
| 1138 return; | 1133 return; |
| 1139 } | 1134 } |
| 1140 | 1135 |
| 1141 v8::Local<v8::Value> result; | 1136 v8::Local<v8::Value> result; |
| 1142 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 1137 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
| 1143 args->Return(result); | 1138 args->Return(result); |
| 1144 } | 1139 } |
| 1145 | 1140 |
| 1146 } // namespace content | 1141 } // namespace content |
| OLD | NEW |