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

Side by Side Diff: Source/core/fetch/ResourcePtr.h

Issue 1310643003: Make classes and structures in core/events and core/fetch fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef ResourcePtr_h 26 #ifndef ResourcePtr_h
27 #define ResourcePtr_h 27 #define ResourcePtr_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/fetch/Resource.h" 30 #include "core/fetch/Resource.h"
31 #include "wtf/Allocator.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 class CORE_EXPORT ResourcePtrBase { 35 class CORE_EXPORT ResourcePtrBase {
36 ALLOW_ONLY_INLINE_ALLOCATION();
35 public: 37 public:
36 Resource* get() const { return m_resource; } 38 Resource* get() const { return m_resource; }
37 bool operator!() const { return !m_resource; } 39 bool operator!() const { return !m_resource; }
38 void clear() { setResource(nullptr); } 40 void clear() { setResource(nullptr); }
39 41
40 // This conversion operator allows implicit conversion to bool but not to ot her integer types. 42 // This conversion operator allows implicit conversion to bool but not to ot her integer types.
41 typedef Resource* ResourcePtrBase::*UnspecifiedBoolType; 43 typedef Resource* ResourcePtrBase::*UnspecifiedBoolType;
42 operator UnspecifiedBoolType() const { return m_resource ? &ResourcePtrBase: :m_resource : nullptr; } 44 operator UnspecifiedBoolType() const { return m_resource ? &ResourcePtrBase: :m_resource : nullptr; }
43 45
44 protected: 46 protected:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 { 113 {
112 return h.get() != res; 114 return h.get() != res;
113 } 115 }
114 template <class R, class RR> bool operator!=(const RR* res, const ResourcePtr<R> & h) 116 template <class R, class RR> bool operator!=(const RR* res, const ResourcePtr<R> & h)
115 { 117 {
116 return h.get() != res; 118 return h.get() != res;
117 } 119 }
118 } 120 }
119 121
120 #endif 122 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698