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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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/web/tests/WebFrameTest.cpp ('k') | Source/wtf/ArrayBufferView.cpp » ('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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBuffer* other) 98 PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBuffer* other)
99 { 99 {
100 return ArrayBuffer::create(other->data(), other->byteLength()); 100 return ArrayBuffer::create(other->data(), other->byteLength());
101 } 101 }
102 102
103 PassRefPtr<ArrayBuffer> ArrayBuffer::create(const void* source, unsigned byteLen gth) 103 PassRefPtr<ArrayBuffer> ArrayBuffer::create(const void* source, unsigned byteLen gth)
104 { 104 {
105 ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::ZeroInitial ize); 105 ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::ZeroInitial ize);
106 if (!contents.data()) 106 if (!contents.data())
107 return 0; 107 return nullptr;
108 RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents)); 108 RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents));
109 memcpy(buffer->data(), source, byteLength); 109 memcpy(buffer->data(), source, byteLength);
110 return buffer.release(); 110 return buffer.release();
111 } 111 }
112 112
113 PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBufferContents& contents) 113 PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBufferContents& contents)
114 { 114 {
115 return adoptRef(new ArrayBuffer(contents)); 115 return adoptRef(new ArrayBuffer(contents));
116 } 116 }
117 117
118 PassRefPtr<ArrayBuffer> ArrayBuffer::createUninitialized(unsigned numElements, u nsigned elementByteSize) 118 PassRefPtr<ArrayBuffer> ArrayBuffer::createUninitialized(unsigned numElements, u nsigned elementByteSize)
119 { 119 {
120 return create(numElements, elementByteSize, ArrayBufferContents::DontInitial ize); 120 return create(numElements, elementByteSize, ArrayBufferContents::DontInitial ize);
121 } 121 }
122 122
123 PassRefPtr<ArrayBuffer> ArrayBuffer::create(unsigned numElements, unsigned eleme ntByteSize, ArrayBufferContents::InitializationPolicy policy) 123 PassRefPtr<ArrayBuffer> ArrayBuffer::create(unsigned numElements, unsigned eleme ntByteSize, ArrayBufferContents::InitializationPolicy policy)
124 { 124 {
125 ArrayBufferContents contents(numElements, elementByteSize, policy); 125 ArrayBufferContents contents(numElements, elementByteSize, policy);
126 if (!contents.data()) 126 if (!contents.data())
127 return 0; 127 return nullptr;
128 return adoptRef(new ArrayBuffer(contents)); 128 return adoptRef(new ArrayBuffer(contents));
129 } 129 }
130 130
131 ArrayBuffer::ArrayBuffer(ArrayBufferContents& contents) 131 ArrayBuffer::ArrayBuffer(ArrayBufferContents& contents)
132 : m_firstView(0), m_isNeutered(false) 132 : m_firstView(0), m_isNeutered(false)
133 { 133 {
134 contents.transfer(m_contents); 134 contents.transfer(m_contents);
135 } 135 }
136 136
137 void* ArrayBuffer::data() 137 void* ArrayBuffer::data()
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (index < 0) 171 if (index < 0)
172 index = currentLength + index; 172 index = currentLength + index;
173 return clampValue(index, 0, currentLength); 173 return clampValue(index, 0, currentLength);
174 } 174 }
175 175
176 } // namespace WTF 176 } // namespace WTF
177 177
178 using WTF::ArrayBuffer; 178 using WTF::ArrayBuffer;
179 179
180 #endif // ArrayBuffer_h 180 #endif // ArrayBuffer_h
OLDNEW
« no previous file with comments | « Source/web/tests/WebFrameTest.cpp ('k') | Source/wtf/ArrayBufferView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698