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

Unified Diff: third_party/WebKit/public/platform/WebPassOwnPtr.h

Issue 1865913005: Nuke WebPassOwnPtr<T> and replace it with std::unique_ptr<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
Index: third_party/WebKit/public/platform/WebPassOwnPtr.h
diff --git a/third_party/WebKit/public/platform/WebPassOwnPtr.h b/third_party/WebKit/public/platform/WebPassOwnPtr.h
deleted file mode 100644
index e818b70baaea6def6e62322915d6d4af10280949..0000000000000000000000000000000000000000
--- a/third_party/WebKit/public/platform/WebPassOwnPtr.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2015 The Chromium 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 WebPassOwnPtr_h
-#define WebPassOwnPtr_h
-
-#include "public/platform/WebCommon.h"
-#include <cstddef>
-#include <memory>
-
-#if INSIDE_BLINK
-#include "wtf/PassOwnPtr.h"
-#endif
-
-namespace blink {
-
-// WebPassOwnPtr<T> is used to pass a T pointer with ownership from chromium
-// side to blink side. T's definition must be shared among all users
-// (especially between chromium and blink).
-// TODO(yhirano): Migrate to std::unique_ptr once the repository
-// merge is done or C++11 std library is allowed.
-template <typename T>
-class WebPassOwnPtr final {
-public:
- WebPassOwnPtr() : m_ptr(nullptr) {}
- WebPassOwnPtr(std::nullptr_t) : m_ptr(nullptr) {}
- // We need |const| to bind an rvalue. As a result, |m_ptr| needs to be
- // mutable because we manipulate it.
- template <typename U>
- WebPassOwnPtr(const WebPassOwnPtr<U>& o)
- {
- m_ptr = o.m_ptr;
- o.m_ptr = nullptr;
- }
- WebPassOwnPtr(const WebPassOwnPtr& o)
- {
- m_ptr = o.m_ptr;
- o.m_ptr = nullptr;
- }
- ~WebPassOwnPtr()
- {
- delete m_ptr;
- }
- WebPassOwnPtr& operator =(const WebPassOwnPtr&) = delete;
-
-#if INSIDE_BLINK
- PassOwnPtr<T> release()
- {
- T* ptr = m_ptr;
- m_ptr = nullptr;
- return adoptPtr(ptr);
- }
-#else
- operator std::unique_ptr<T>()
- {
- T* ptr = m_ptr;
- m_ptr = nullptr;
- return std::unique_ptr<T>(ptr);
- }
-#endif // INSIDE_BLINK
-
- template <typename U> friend class WebPassOwnPtr;
- template <typename U> friend WebPassOwnPtr<U> adoptWebPtr(U*);
-
-private:
- explicit WebPassOwnPtr(T* ptr) : m_ptr(ptr) {}
-
- // See the constructor comment to see why |mutable| is needed.
- mutable T* m_ptr;
-};
-
-template <typename T>
-WebPassOwnPtr<T> adoptWebPtr(T* p) { return WebPassOwnPtr<T>(p); }
-
-} // namespace blink
-
-#endif

Powered by Google App Engine
This is Rietveld 408576698