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

Side by Side Diff: Source/wtf/WeakPtr.h

Issue 304323010: Oilpan: have DocumentInit use transition types throughout. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add WeakPtrWillBeMember transition type Created 6 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 #ifndef NDEBUG 78 #ifndef NDEBUG
79 ThreadIdentifier m_boundThread; 79 ThreadIdentifier m_boundThread;
80 #endif 80 #endif
81 }; 81 };
82 82
83 template<typename T> 83 template<typename T>
84 class WeakPtr { 84 class WeakPtr {
85 WTF_MAKE_FAST_ALLOCATED; 85 WTF_MAKE_FAST_ALLOCATED;
86 public: 86 public:
87 WeakPtr() { } 87 WeakPtr() { }
88 WeakPtr(std::nullptr_t) { }
88 WeakPtr(PassRefPtr<WeakReference<T> > ref) : m_ref(ref) { } 89 WeakPtr(PassRefPtr<WeakReference<T> > ref) : m_ref(ref) { }
89 90
90 T* get() const { return m_ref ? m_ref->get() : 0; } 91 T* get() const { return m_ref ? m_ref->get() : 0; }
91 void clear() { m_ref.clear(); } 92 void clear() { m_ref.clear(); }
92 93
93 T* operator->() const 94 T* operator->() const
94 { 95 {
95 ASSERT(get()); 96 ASSERT(get());
96 return get(); 97 return get();
97 } 98 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 RefPtr<WeakReference<T> > m_ref; 144 RefPtr<WeakReference<T> > m_ref;
144 }; 145 };
145 146
146 } // namespace WTF 147 } // namespace WTF
147 148
148 using WTF::WeakPtr; 149 using WTF::WeakPtr;
149 using WTF::WeakPtrFactory; 150 using WTF::WeakPtrFactory;
150 using WTF::WeakReference; 151 using WTF::WeakReference;
151 152
152 #endif 153 #endif
OLDNEW
« Source/core/dom/DocumentInit.h ('K') | « Source/platform/heap/Handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698