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

Side by Side Diff: mojo/system/memory.h

Issue 597413002: Mojo: NULL -> nullptr in mojo/system and mojo/embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: EXPECT_TRUE Created 6 years, 2 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
« no previous file with comments | « mojo/system/local_message_pipe_endpoint.cc ('k') | mojo/system/memory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SYSTEM_MEMORY_H_ 5 #ifndef MOJO_SYSTEM_MEMORY_H_
6 #define MOJO_SYSTEM_MEMORY_H_ 6 #define MOJO_SYSTEM_MEMORY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <string.h> // For |memcpy()|. 10 #include <string.h> // For |memcpy()|.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 template <typename Type> 84 template <typename Type>
85 class UserPointer { 85 class UserPointer {
86 private: 86 private:
87 typedef typename internal::VoidToChar<Type>::type NonVoidType; 87 typedef typename internal::VoidToChar<Type>::type NonVoidType;
88 88
89 public: 89 public:
90 // Instead of explicitly using these constructors, you can often use 90 // Instead of explicitly using these constructors, you can often use
91 // |MakeUserPointer()| (or |NullUserPointer()| for null pointers). (The common 91 // |MakeUserPointer()| (or |NullUserPointer()| for null pointers). (The common
92 // exception is when you have, e.g., a |char*| and want to get a 92 // exception is when you have, e.g., a |char*| and want to get a
93 // |UserPointer<void>|.) 93 // |UserPointer<void>|.)
94 UserPointer() : pointer_(NULL) {} 94 UserPointer() : pointer_(nullptr) {}
95 explicit UserPointer(Type* pointer) : pointer_(pointer) {} 95 explicit UserPointer(Type* pointer) : pointer_(pointer) {}
96 // Allow implicit conversion from the "null user pointer". 96 // Allow implicit conversion from the "null user pointer".
97 UserPointer(NullUserPointer) : pointer_(NULL) {} 97 UserPointer(NullUserPointer) : pointer_(nullptr) {}
98 ~UserPointer() {} 98 ~UserPointer() {}
99 99
100 // Allow assignment from the "null user pointer". 100 // Allow assignment from the "null user pointer".
101 UserPointer<Type>& operator=(NullUserPointer) { 101 UserPointer<Type>& operator=(NullUserPointer) {
102 pointer_ = NULL; 102 pointer_ = nullptr;
103 return *this; 103 return *this;
104 } 104 }
105 105
106 // Allow conversion to a "non-const" |UserPointer|. 106 // Allow conversion to a "non-const" |UserPointer|.
107 operator UserPointer<const Type>() const { 107 operator UserPointer<const Type>() const {
108 return UserPointer<const Type>(pointer_); 108 return UserPointer<const Type>(pointer_);
109 } 109 }
110 110
111 bool IsNull() const { return !pointer_; } 111 bool IsNull() const { return !pointer_; }
112 112
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 size_t count_; 368 size_t count_;
369 scoped_ptr<Type[]> buffer_; 369 scoped_ptr<Type[]> buffer_;
370 370
371 DISALLOW_COPY_AND_ASSIGN(UserPointerReaderWriter); 371 DISALLOW_COPY_AND_ASSIGN(UserPointerReaderWriter);
372 }; 372 };
373 373
374 } // namespace system 374 } // namespace system
375 } // namespace mojo 375 } // namespace mojo
376 376
377 #endif // MOJO_SYSTEM_MEMORY_H_ 377 #endif // MOJO_SYSTEM_MEMORY_H_
OLDNEW
« no previous file with comments | « mojo/system/local_message_pipe_endpoint.cc ('k') | mojo/system/memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698