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

Unified Diff: core/fxcrt/cfx_maybe_owned.h

Issue 2522313002: Use CFX_MaybeOwned<> in fpdf_edit_create.cpp (Closed)
Patch Set: nits Created 4 years, 1 month 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 | « core/fpdfapi/parser/cpdf_stream_acc.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/cfx_maybe_owned.h
diff --git a/core/fxcrt/cfx_maybe_owned.h b/core/fxcrt/cfx_maybe_owned.h
index 76bd580e28dbd52cc2c0e7bb41158cd718c95c84..92b1c1c24254bbf7f110cea83e4ec6145f94337c 100644
--- a/core/fxcrt/cfx_maybe_owned.h
+++ b/core/fxcrt/cfx_maybe_owned.h
@@ -21,7 +21,7 @@ class CFX_MaybeOwned {
public:
CFX_MaybeOwned() : m_pObj(nullptr) {}
explicit CFX_MaybeOwned(T* ptr) : m_pObj(ptr) {}
- explicit CFX_MaybeOwned(std::unique_ptr<T> ptr)
+ explicit CFX_MaybeOwned(std::unique_ptr<T, D> ptr)
: m_pOwnedObj(std::move(ptr)), m_pObj(m_pOwnedObj.get()) {}
CFX_MaybeOwned(const CFX_MaybeOwned& that) = delete;
@@ -30,7 +30,7 @@ class CFX_MaybeOwned {
that.m_pObj = nullptr;
}
- void Reset(std::unique_ptr<T> ptr) {
+ void Reset(std::unique_ptr<T, D> ptr) {
m_pOwnedObj = std::move(ptr);
m_pObj = m_pOwnedObj.get();
}
@@ -41,7 +41,7 @@ class CFX_MaybeOwned {
bool IsOwned() const { return !!m_pOwnedObj; }
T* Get() const { return m_pObj; }
- std::unique_ptr<T> Release() {
+ std::unique_ptr<T, D> Release() {
ASSERT(IsOwned());
return std::move(m_pOwnedObj);
}
@@ -57,7 +57,7 @@ class CFX_MaybeOwned {
Reset(ptr);
return *this;
}
- CFX_MaybeOwned& operator=(std::unique_ptr<T> ptr) {
+ CFX_MaybeOwned& operator=(std::unique_ptr<T, D> ptr) {
Reset(std::move(ptr));
return *this;
}
@@ -65,13 +65,13 @@ class CFX_MaybeOwned {
bool operator==(const CFX_MaybeOwned& that) const {
return Get() == that.Get();
}
- bool operator==(const std::unique_ptr<T>& ptr) const {
+ bool operator==(const std::unique_ptr<T, D>& ptr) const {
return Get() == ptr.get();
}
bool operator==(T* ptr) const { return Get() == ptr; }
bool operator!=(const CFX_MaybeOwned& that) const { return !(*this == that); }
- bool operator!=(const std::unique_ptr<T> ptr) const {
+ bool operator!=(const std::unique_ptr<T, D> ptr) const {
return !(*this == ptr);
}
bool operator!=(T* ptr) const { return !(*this == ptr); }
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream_acc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698