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

Unified Diff: core/fxcrt/include/cfx_retain_ptr.h

Issue 2382723003: Move core/fxcrt/include to core/fxcrt (Closed)
Patch Set: Rebase to master Created 4 years, 3 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 | « core/fxcrt/include/cfx_observable.h ('k') | core/fxcrt/include/cfx_string_pool_template.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/include/cfx_retain_ptr.h
diff --git a/core/fxcrt/include/cfx_retain_ptr.h b/core/fxcrt/include/cfx_retain_ptr.h
deleted file mode 100644
index e40feb6b31c765ad56a0fc31495991364f9b0daa..0000000000000000000000000000000000000000
--- a/core/fxcrt/include/cfx_retain_ptr.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_
-#define CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_
-
-#include <memory>
-
-#include "core/fxcrt/include/fx_memory.h"
-
-template <class T>
-class CFX_RetainPtr {
- public:
- explicit CFX_RetainPtr(T* pObj) : m_pObj(pObj) {
- if (m_pObj)
- m_pObj->Retain();
- }
-
- CFX_RetainPtr() : CFX_RetainPtr(nullptr) {}
- CFX_RetainPtr(const CFX_RetainPtr& that) : CFX_RetainPtr(that.Get()) {}
- CFX_RetainPtr(CFX_RetainPtr&& that) { Swap(that); }
-
- template <class U>
- CFX_RetainPtr(const CFX_RetainPtr<U>& that)
- : CFX_RetainPtr(that.Get()) {}
-
- void Reset(T* obj = nullptr) {
- if (obj)
- obj->Retain();
- m_pObj.reset(obj);
- }
-
- T* Get() const { return m_pObj.get(); }
- void Swap(CFX_RetainPtr& that) { m_pObj.swap(that.m_pObj); }
-
- CFX_RetainPtr& operator=(const CFX_RetainPtr& that) {
- if (*this != that)
- Reset(that.Get());
- return *this;
- }
-
- bool operator==(const CFX_RetainPtr& that) const {
- return Get() == that.Get();
- }
-
- bool operator!=(const CFX_RetainPtr& that) const { return !(*this == that); }
-
- explicit operator bool() const { return !!m_pObj; }
- T& operator*() const { return *m_pObj.get(); }
- T* operator->() const { return m_pObj.get(); }
-
- private:
- std::unique_ptr<T, ReleaseDeleter<T>> m_pObj;
-};
-
-#endif // CORE_FXCRT_INCLUDE_CFX_RETAIN_PTR_H_
« no previous file with comments | « core/fxcrt/include/cfx_observable.h ('k') | core/fxcrt/include/cfx_string_pool_template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698