xref: /aosp_15_r20/external/skia/src/utils/win/SkObjBase.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker /*
2*c8dee2aaSAndroid Build Coastguard Worker * Copyright 2019 Google Inc.
3*c8dee2aaSAndroid Build Coastguard Worker *
4*c8dee2aaSAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license that can be
5*c8dee2aaSAndroid Build Coastguard Worker * found in the LICENSE file.
6*c8dee2aaSAndroid Build Coastguard Worker */
7*c8dee2aaSAndroid Build Coastguard Worker 
8*c8dee2aaSAndroid Build Coastguard Worker #ifndef SkObjBase_DEFINED
9*c8dee2aaSAndroid Build Coastguard Worker #define SkObjBase_DEFINED
10*c8dee2aaSAndroid Build Coastguard Worker 
11*c8dee2aaSAndroid Build Coastguard Worker #include "src/base/SkLeanWindows.h"
12*c8dee2aaSAndroid Build Coastguard Worker #include <objbase.h>
13*c8dee2aaSAndroid Build Coastguard Worker 
14*c8dee2aaSAndroid Build Coastguard Worker // STDMETHOD uses COM_DECLSPEC_NOTHROW, but STDMETHODIMP does not. This leads to attribute mismatch
15*c8dee2aaSAndroid Build Coastguard Worker // between interfaces and implementations which produces warnings. In theory a COM component should
16*c8dee2aaSAndroid Build Coastguard Worker // never throw a c++ exception, but COM_DECLSPEC_NOTHROW allows tweaking that (as it may be useful
17*c8dee2aaSAndroid Build Coastguard Worker // for internal only implementations within a single project). The behavior of the attribute nothrow
18*c8dee2aaSAndroid Build Coastguard Worker // and the keyword noexcept are slightly different, so use COM_DECLSPEC_NOTHROW instead of noexcept.
19*c8dee2aaSAndroid Build Coastguard Worker // Older interfaces like IUnknown and IStream do not currently specify COM_DECLSPEC_NOTHROW, but it
20*c8dee2aaSAndroid Build Coastguard Worker // is not harmful to mark the implementation more exception strict than the interface.
21*c8dee2aaSAndroid Build Coastguard Worker 
22*c8dee2aaSAndroid Build Coastguard Worker #define SK_STDMETHODIMP COM_DECLSPEC_NOTHROW STDMETHODIMP
23*c8dee2aaSAndroid Build Coastguard Worker #define SK_STDMETHODIMP_(type) COM_DECLSPEC_NOTHROW STDMETHODIMP_(type)
24*c8dee2aaSAndroid Build Coastguard Worker 
25*c8dee2aaSAndroid Build Coastguard Worker #endif
26