Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
com_factory.cc
Go to the documentation of this file.
1
// Copyright 2023 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#
include
"testing/helpers/win32/com_factory.h"
6
7
#
include
<
combaseapi
.
h
>
8
#
include
<
objbase
.
h
>
9
#
include
<
winerror
.
h
>
10
#
include
<
xpsobjectmodel
.
h
>
11
12
#
include
"core/fxcrt/check_op.h"
13
14
ComFactory::
ComFactory
() =
default
;
15
16
ComFactory::~
ComFactory
() {
17
if
(xps_om_object_factory_) {
18
xps_om_object_factory_->Release();
19
}
20
21
if
(initialized_) {
22
CoUninitialize();
23
}
24
}
25
26
bool
ComFactory::Initialize() {
27
if
(!initialized_) {
28
HRESULT result =
29
CoInitializeEx(
nullptr
, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
30
DCHECK_NE
(RPC_E_CHANGED_MODE, result);
31
initialized_ = SUCCEEDED(result);
32
}
33
34
return
initialized_;
35
}
36
37
IXpsOMObjectFactory* ComFactory::
GetXpsOMObjectFactory
() {
38
if
(!xps_om_object_factory_ && Initialize()) {
39
HRESULT result =
40
CoCreateInstance(__uuidof(XpsOMObjectFactory),
/*pUnkOuter=*/
nullptr
,
41
CLSCTX_INPROC_SERVER, __uuidof(IXpsOMObjectFactory),
42
reinterpret_cast
<LPVOID*>(&xps_om_object_factory_));
43
if
(SUCCEEDED(result)) {
44
DCHECK
(xps_om_object_factory_);
45
}
else
{
46
DCHECK
(!xps_om_object_factory_);
47
}
48
}
49
50
return
xps_om_object_factory_;
51
}
DCHECK
#define DCHECK
Definition
check.h:33
DCHECK_NE
#define DCHECK_NE(x, y)
Definition
check_op.h:18
ComFactory::GetXpsOMObjectFactory
IXpsOMObjectFactory * GetXpsOMObjectFactory()
Definition
com_factory.cc:37
ComFactory::ComFactory
ComFactory()
ComFactory::~ComFactory
~ComFactory()
Definition
com_factory.cc:16
qtwebengine
src
3rdparty
chromium
third_party
pdfium
testing
helpers
win32
com_factory.cc
Generated on
for Qt by
1.18.0