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

Unified Diff: include/utils/win/SkTScopedComPtr.h

Issue 2070983002: Move headers in include/utils/win to src/utils/win. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Really rebase. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/utils/win/SkIStream.h ('k') | src/utils/win/SkAutoCoInitialize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/win/SkTScopedComPtr.h
diff --git a/include/utils/win/SkTScopedComPtr.h b/include/utils/win/SkTScopedComPtr.h
deleted file mode 100644
index 6fb6143adc71a74c4d74b9cc807921cfbadfa4e9..0000000000000000000000000000000000000000
--- a/include/utils/win/SkTScopedComPtr.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkTScopedComPtr_DEFINED
-#define SkTScopedComPtr_DEFINED
-
-#include "../../private/SkLeanWindows.h"
-
-#ifdef SK_BUILD_FOR_WIN
-
-template<typename T>
-class SkBlockComRef : public T {
-private:
- virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0;
- virtual ULONG STDMETHODCALLTYPE Release(void) = 0;
-};
-
-template<typename T> T* SkRefComPtr(T* ptr) {
- ptr->AddRef();
- return ptr;
-}
-
-template<typename T> T* SkSafeRefComPtr(T* ptr) {
- if (ptr) {
- ptr->AddRef();
- }
- return ptr;
-}
-
-template<typename T>
-class SkTScopedComPtr : SkNoncopyable {
-private:
- T *fPtr;
-
-public:
- explicit SkTScopedComPtr(T *ptr = NULL) : fPtr(ptr) { }
- ~SkTScopedComPtr() {
- this->reset();
- }
- T &operator*() const { SkASSERT(fPtr != NULL); return *fPtr; }
- SkBlockComRef<T> *operator->() const {
- return static_cast<SkBlockComRef<T>*>(fPtr);
- }
- /**
- * Returns the address of the underlying pointer.
- * This is dangerous -- it breaks encapsulation and the reference escapes.
- * Must only be used on instances currently pointing to NULL,
- * and only to initialize the instance.
- */
- T **operator&() { SkASSERT(fPtr == NULL); return &fPtr; }
- T *get() const { return fPtr; }
- void reset() {
- if (this->fPtr) {
- this->fPtr->Release();
- this->fPtr = NULL;
- }
- }
-
- void swap(SkTScopedComPtr<T>& that) {
- T* temp = this->fPtr;
- this->fPtr = that.fPtr;
- that.fPtr = temp;
- }
-
- T* release() {
- T* temp = this->fPtr;
- this->fPtr = NULL;
- return temp;
- }
-};
-
-#endif // SK_BUILD_FOR_WIN
-#endif // SkTScopedComPtr_DEFINED
« no previous file with comments | « include/utils/win/SkIStream.h ('k') | src/utils/win/SkAutoCoInitialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698