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

Unified Diff: third_party/WebKit/Source/wtf/RawPtr.h

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 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 | « third_party/WebKit/Source/wtf/PrintStream.cpp ('k') | third_party/WebKit/Source/wtf/RefCounted.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/RawPtr.h
diff --git a/third_party/WebKit/Source/wtf/RawPtr.h b/third_party/WebKit/Source/wtf/RawPtr.h
index a6668734163ba3deb6ccc98db0fa5918142a3821..2d5a6a386230d3e70c3b96eded8366b037d9f084 100644
--- a/third_party/WebKit/Source/wtf/RawPtr.h
+++ b/third_party/WebKit/Source/wtf/RawPtr.h
@@ -47,103 +47,91 @@
namespace WTF {
-template<typename T>
+template <typename T>
class RawPtr {
- USING_FAST_MALLOC(RawPtr);
-public:
- RawPtr()
- {
+ USING_FAST_MALLOC(RawPtr);
+
+ public:
+ RawPtr() {
#if ENABLE(ASSERT)
- m_ptr = reinterpret_cast<T*>(rawPtrZapValue);
+ m_ptr = reinterpret_cast<T*>(rawPtrZapValue);
#endif
- }
- RawPtr(std::nullptr_t) : m_ptr(0) { }
- RawPtr(T* ptr) : m_ptr(ptr) { }
- explicit RawPtr(T& reference) : m_ptr(&reference) { }
- RawPtr(const RawPtr& other)
- : m_ptr(other.get())
- {
- }
-
- template<typename U>
- RawPtr(const RawPtr<U>& other, EnsurePtrConvertibleArgDecl(U, T))
- : m_ptr(other.get())
- {
- }
-
- // Hash table deleted values, which are only constructed and never copied or destroyed.
- RawPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
- bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
-
- T* get() const { return m_ptr; }
- void clear() { m_ptr = 0; }
- RawPtr<T> release()
- {
- RawPtr<T> tmp = m_ptr;
- m_ptr = 0;
- return tmp;
- }
- T* leakRef()
- {
- T* ptr = m_ptr;
- m_ptr = 0;
- return ptr;
- }
- T* leakPtr()
- {
- T* ptr = m_ptr;
- m_ptr = 0;
- return ptr;
- }
-
- template<typename U>
- RawPtr& operator=(U* ptr)
- {
- m_ptr = ptr;
- return *this;
- }
-
- template<typename U>
- RawPtr& operator=(RawPtr<U> ptr)
- {
- m_ptr = ptr.get();
- return *this;
- }
-
- RawPtr& operator=(std::nullptr_t)
- {
- m_ptr = 0;
- return *this;
- }
-
- operator T*() const { return m_ptr; }
- T& operator*() const { return *m_ptr; }
- T* operator->() const { return m_ptr; }
- bool operator!() const { return !m_ptr; }
-
- void swap(RawPtr& o)
- {
- std::swap(m_ptr, o.m_ptr);
- }
-
- static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
-
-private:
- static const uintptr_t rawPtrZapValue = 0x3a3a3a3a;
- T* m_ptr;
+ }
+ RawPtr(std::nullptr_t) : m_ptr(0) {}
+ RawPtr(T* ptr) : m_ptr(ptr) {}
+ explicit RawPtr(T& reference) : m_ptr(&reference) {}
+ RawPtr(const RawPtr& other) : m_ptr(other.get()) {}
+
+ template <typename U>
+ RawPtr(const RawPtr<U>& other, EnsurePtrConvertibleArgDecl(U, T))
+ : m_ptr(other.get()) {}
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ RawPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) {}
+ bool isHashTableDeletedValue() const {
+ return m_ptr == hashTableDeletedValue();
+ }
+
+ T* get() const { return m_ptr; }
+ void clear() { m_ptr = 0; }
+ RawPtr<T> release() {
+ RawPtr<T> tmp = m_ptr;
+ m_ptr = 0;
+ return tmp;
+ }
+ T* leakRef() {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+ T* leakPtr() {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+ template <typename U>
+ RawPtr& operator=(U* ptr) {
+ m_ptr = ptr;
+ return *this;
+ }
+
+ template <typename U>
+ RawPtr& operator=(RawPtr<U> ptr) {
+ m_ptr = ptr.get();
+ return *this;
+ }
+
+ RawPtr& operator=(std::nullptr_t) {
+ m_ptr = 0;
+ return *this;
+ }
+
+ operator T*() const { return m_ptr; }
+ T& operator*() const { return *m_ptr; }
+ T* operator->() const { return m_ptr; }
+ bool operator!() const { return !m_ptr; }
+
+ void swap(RawPtr& o) { std::swap(m_ptr, o.m_ptr); }
+
+ static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
+
+ private:
+ static const uintptr_t rawPtrZapValue = 0x3a3a3a3a;
+ T* m_ptr;
};
-template<typename T, typename U> inline RawPtr<T> static_pointer_cast(const RawPtr<U>& p)
-{
- return RawPtr<T>(static_cast<T*>(p.get()));
+template <typename T, typename U>
+inline RawPtr<T> static_pointer_cast(const RawPtr<U>& p) {
+ return RawPtr<T>(static_cast<T*>(p.get()));
}
-template<typename T> inline T* getPtr(const RawPtr<T>& p)
-{
- return p.get();
+template <typename T>
+inline T* getPtr(const RawPtr<T>& p) {
+ return p.get();
}
-} // namespace WTF
+} // namespace WTF
using WTF::RawPtr;
« no previous file with comments | « third_party/WebKit/Source/wtf/PrintStream.cpp ('k') | third_party/WebKit/Source/wtf/RefCounted.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698