aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-01-24 11:11:31 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-25 18:54:37 +0000
commitb2cd1d7b442b689ff74409029defbf505c044b2c (patch)
tree85d555c56869d73e938ce8c817b47e3d64192b20
parentd46697ac36d5cb3b58571c6129cb5b26fe9d25d7 (diff)
utils/win/SkTScopedComPtr<T>: Add C++11ish move semantics
Change-Id: I026ffa81d583fddc4a2c7238a176232ef98fcd89 Reviewed-on: https://skia-review.googlesource.com/7434 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
-rw-r--r--src/utils/win/SkTScopedComPtr.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/utils/win/SkTScopedComPtr.h b/src/utils/win/SkTScopedComPtr.h
index 105b6017da..b8aeb73d82 100644
--- a/src/utils/win/SkTScopedComPtr.h
+++ b/src/utils/win/SkTScopedComPtr.h
@@ -32,7 +32,7 @@ template<typename T> T* SkSafeRefComPtr(T* ptr) {
}
template<typename T>
-class SkTScopedComPtr : SkNoncopyable {
+class SkTScopedComPtr {
private:
T *fPtr;
@@ -41,6 +41,14 @@ public:
~SkTScopedComPtr() { this->reset();}
+ SkTScopedComPtr(SkTScopedComPtr&& that) : fPtr(that.release()) {}
+ SkTScopedComPtr(const SkTScopedComPtr&) = delete;
+ SkTScopedComPtr& operator=(SkTScopedComPtr&& that) {
+ this->reset(that.release());
+ return *this;
+ }
+ SkTScopedComPtr& operator=(const SkTScopedComPtr&) = delete;
+
T &operator*() const { SkASSERT(fPtr != nullptr); return *fPtr; }
explicit operator bool() const { return fPtr != nullptr; }