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

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

Issue 1436153002: Apply clang-format with Chromium-style without column limit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « 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 c3a82ec4b72d51c961d40dfce960f477d3e713c3..2016d7e58aacd77514f7edd4fe35d16f9ba09e7f 100644
--- a/third_party/WebKit/Source/wtf/RawPtr.h
+++ b/third_party/WebKit/Source/wtf/RawPtr.h
@@ -46,102 +46,96 @@
namespace WTF {
-template<typename T>
+template <typename T>
class RawPtr {
-public:
- 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