| Index: src/utils/win/SkTScopedComPtr.h
|
| diff --git a/include/utils/win/SkTScopedComPtr.h b/src/utils/win/SkTScopedComPtr.h
|
| similarity index 73%
|
| rename from include/utils/win/SkTScopedComPtr.h
|
| rename to src/utils/win/SkTScopedComPtr.h
|
| index 6fb6143adc71a74c4d74b9cc807921cfbadfa4e9..5410f5c99269cfd1d71a9c34404e162ae970116d 100644
|
| --- a/include/utils/win/SkTScopedComPtr.h
|
| +++ b/src/utils/win/SkTScopedComPtr.h
|
| @@ -8,7 +8,7 @@
|
| #ifndef SkTScopedComPtr_DEFINED
|
| #define SkTScopedComPtr_DEFINED
|
|
|
| -#include "../../private/SkLeanWindows.h"
|
| +#include "SkLeanWindows.h"
|
|
|
| #ifdef SK_BUILD_FOR_WIN
|
|
|
| @@ -37,26 +37,30 @@ 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);
|
| - }
|
| + explicit SkTScopedComPtr(T *ptr = nullptr) : fPtr(ptr) { }
|
| +
|
| + ~SkTScopedComPtr() { this->reset();}
|
| +
|
| + T &operator*() const { SkASSERT(fPtr != nullptr); return *fPtr; }
|
| +
|
| + explicit operator bool() const { return fPtr != nullptr; }
|
| +
|
| + 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 **operator&() { SkASSERT(fPtr == nullptr); return &fPtr; }
|
| +
|
| T *get() const { return fPtr; }
|
| +
|
| void reset() {
|
| if (this->fPtr) {
|
| this->fPtr->Release();
|
| - this->fPtr = NULL;
|
| + this->fPtr = nullptr;
|
| }
|
| }
|
|
|
| @@ -68,7 +72,7 @@ public:
|
|
|
| T* release() {
|
| T* temp = this->fPtr;
|
| - this->fPtr = NULL;
|
| + this->fPtr = nullptr;
|
| return temp;
|
| }
|
| };
|
|
|