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

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

Issue 2887243002: Remove ScopedComPtr::CreateInstance() (Closed)
Patch Set: Created 3 years, 7 months 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "third_party/skia/include/core/SkStream.h" 56 #include "third_party/skia/include/core/SkStream.h"
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 <objbase.h>
66 #include "base/win/scoped_comptr.h" 67 #include "base/win/scoped_comptr.h"
67 #endif 68 #endif
68 69
69 using blink::WebCanvas; 70 using blink::WebCanvas;
70 using blink::WebLocalFrame; 71 using blink::WebLocalFrame;
71 using blink::WebImageCache; 72 using blink::WebImageCache;
72 using blink::WebPrivatePtr; 73 using blink::WebPrivatePtr;
73 using blink::WebSize; 74 using blink::WebSize;
74 using blink::WebView; 75 using blink::WebView;
75 76
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // Also note: You must execute Chrome with `--no-sandbox` and 523 // Also note: You must execute Chrome with `--no-sandbox` and
523 // `--enable-gpu-benchmarking` for this to work. 524 // `--enable-gpu-benchmarking` for this to work.
524 #if defined(OS_WIN) && !defined(NDEBUG) 525 #if defined(OS_WIN) && !defined(NDEBUG)
525 static sk_sp<SkDocument> MakeXPSDocument(SkWStream* s) { 526 static sk_sp<SkDocument> MakeXPSDocument(SkWStream* s) {
526 // I am not sure why this hasn't been initialized yet. 527 // I am not sure why this hasn't been initialized yet.
527 (void)CoInitializeEx(nullptr, 528 (void)CoInitializeEx(nullptr,
528 COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); 529 COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
529 // In non-sandboxed mode, we will need to create and hold on to the 530 // In non-sandboxed mode, we will need to create and hold on to the
530 // factory before entering the sandbox. 531 // factory before entering the sandbox.
531 base::win::ScopedComPtr<IXpsOMObjectFactory> factory; 532 base::win::ScopedComPtr<IXpsOMObjectFactory> factory;
532 HRESULT hr = factory.CreateInstance(CLSID_XpsOMObjectFactory, nullptr, 533 HRESULT hr = ::CoCreateInstance(CLSID_XpsOMObjectFactory, nullptr,
533 CLSCTX_INPROC_SERVER); 534 CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&factory));
534 if (FAILED(hr) || !factory) { 535 if (FAILED(hr) || !factory) {
535 LOG(ERROR) << "CoCreateInstance(CLSID_XpsOMObjectFactory, ...) failed:" 536 LOG(ERROR) << "CoCreateInstance(CLSID_XpsOMObjectFactory, ...) failed:"
536 << logging::SystemErrorCodeToString(hr); 537 << logging::SystemErrorCodeToString(hr);
537 } 538 }
538 return SkDocument::MakeXPS(s, factory.Get()); 539 return SkDocument::MakeXPS(s, factory.Get());
539 } 540 }
540 #endif 541 #endif
541 } // namespace 542 } // namespace
542 543
543 gin::WrapperInfo GpuBenchmarking::kWrapperInfo = {gin::kEmbedderNativeGin}; 544 gin::WrapperInfo GpuBenchmarking::kWrapperInfo = {gin::kEmbedderNativeGin};
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 &gpu_driver_bug_workarounds))) { 1133 &gpu_driver_bug_workarounds))) {
1133 return; 1134 return;
1134 } 1135 }
1135 1136
1136 v8::Local<v8::Value> result; 1137 v8::Local<v8::Value> result;
1137 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) 1138 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result))
1138 args->Return(result); 1139 args->Return(result);
1139 } 1140 }
1140 1141
1141 } // namespace content 1142 } // namespace content
OLDNEW
« no previous file with comments | « content/common/quarantine/quarantine_win.cc ('k') | device/generic_sensor/platform_sensor_provider_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698