blob: 592c2682d903470d25bc9ec192857ac6b1bdc270 [file] [log] [blame]
bungeman@google.com9df621d2011-06-23 21:43:52 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
bungeman@google.com9df621d2011-06-23 21:43:52 +00006 */
7
bungeman@google.com9df621d2011-06-23 21:43:52 +00008#ifndef SkAutoCo_DEFINED
9#define SkAutoCo_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkTypes.h"
bungeman@google.com9df621d2011-06-23 21:43:52 +000012
halcanary0cbe7ee2015-12-01 09:02:49 -080013#ifdef SK_BUILD_FOR_WIN
14
Mike Kleinc0bd9f92019-04-23 12:05:21 -050015#include "include/private/SkNoncopyable.h"
Ben Wagnerab6eefe2019-05-20 11:02:49 -040016#include "src/core/SkLeanWindows.h"
halcanary4dbbd042016-06-07 17:21:10 -070017
bungeman@google.com9df621d2011-06-23 21:43:52 +000018/**
19 * An instance of this class initializes COM on creation
20 * and closes the COM library on destruction.
21 */
bungeman@google.com2e2f3f52011-09-16 15:37:20 +000022class SkAutoCoInitialize : SkNoncopyable {
bungeman@google.com9df621d2011-06-23 21:43:52 +000023private:
24 HRESULT fHR;
25public:
bungeman@google.com2e2f3f52011-09-16 15:37:20 +000026 SkAutoCoInitialize();
27 ~SkAutoCoInitialize();
28 bool succeeded();
bungeman@google.com9df621d2011-06-23 21:43:52 +000029};
30
halcanary0cbe7ee2015-12-01 09:02:49 -080031#endif // SK_BUILD_FOR_WIN
32#endif // SkAutoCo_DEFINED