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

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

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/PartitionAllocTest.cpp ('k') | Source/wtf/RefCounted.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 namespace WTF { 46 namespace WTF {
47 47
48 template<typename T> 48 template<typename T>
49 class RawPtr { 49 class RawPtr {
50 WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(RawPtr); 50 WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(RawPtr);
51 WTF_DISALLOW_ZERO_ASSIGNMENT(RawPtr); 51 WTF_DISALLOW_ZERO_ASSIGNMENT(RawPtr);
52 public: 52 public:
53 RawPtr() 53 RawPtr()
54 { 54 {
55 #ifndef NDEBUG 55 #if ENABLE(ASSERT)
56 m_ptr = reinterpret_cast<T*>(rawPtrZapValue); 56 m_ptr = reinterpret_cast<T*>(rawPtrZapValue);
57 #endif 57 #endif
58 } 58 }
59 RawPtr(std::nullptr_t) : m_ptr(0) { } 59 RawPtr(std::nullptr_t) : m_ptr(0) { }
60 RawPtr(T* ptr) : m_ptr(ptr) { } 60 RawPtr(T* ptr) : m_ptr(ptr) { }
61 explicit RawPtr(T& reference) : m_ptr(&reference) { } 61 explicit RawPtr(T& reference) : m_ptr(&reference) { }
62 RawPtr(const RawPtr& other) 62 RawPtr(const RawPtr& other)
63 : m_ptr(other.get()) 63 : m_ptr(other.get())
64 { 64 {
65 } 65 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 template<typename T> inline T* getPtr(const RawPtr<T>& p) 135 template<typename T> inline T* getPtr(const RawPtr<T>& p)
136 { 136 {
137 return p.get(); 137 return p.get();
138 } 138 }
139 139
140 } // namespace WTF 140 } // namespace WTF
141 141
142 using WTF::RawPtr; 142 using WTF::RawPtr;
143 143
144 #endif 144 #endif
OLDNEW
« no previous file with comments | « Source/wtf/PartitionAllocTest.cpp ('k') | Source/wtf/RefCounted.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698