webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
com_utils.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // com_utils.h: Utility functions for working with COM objects
8 
9 #ifndef UTIL_COM_UTILS_H
10 #define UTIL_COM_UTILS_H
11 
12 template <typename outType>
13 inline outType *DynamicCastComObject(IUnknown *object)
14 {
15  outType *outObject = nullptr;
16  HRESULT result = object->QueryInterface(__uuidof(outType), reinterpret_cast<void**>(&outObject));
17  if (SUCCEEDED(result))
18  {
19  return outObject;
20  }
21  else
22  {
23  SafeRelease(outObject);
24  return nullptr;
25  }
26 }
27 
28 #endif // UTIL_COM_UTILS_H
HRESULT
Definition: RenderThemeWin.cpp:150
outType * DynamicCastComObject(IUnknown *object)
Definition: com_utils.h:13
result
Definition: target-blank-opener-post-window.php:5
void SafeRelease(T(&resourceBlock)[N])
Definition: angleutils.h:46