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

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

Issue 1315643002: Merge 200961 "Set ArrayBufferContents size to 0 on allocation fa..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2454/
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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/wtf/ArrayBufferContents.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 { 115 {
116 ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::NotShared, ArrayBufferContents::ZeroInitialize); 116 ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::NotShared, ArrayBufferContents::ZeroInitialize);
117 RELEASE_ASSERT(contents.data()); 117 RELEASE_ASSERT(contents.data());
118 RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents)); 118 RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents));
119 memcpy(buffer->data(), source, byteLength); 119 memcpy(buffer->data(), source, byteLength);
120 return buffer.release(); 120 return buffer.release();
121 } 121 }
122 122
123 PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBufferContents& contents) 123 PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBufferContents& contents)
124 { 124 {
125 RELEASE_ASSERT(contents.data());
125 return adoptRef(new ArrayBuffer(contents)); 126 return adoptRef(new ArrayBuffer(contents));
126 } 127 }
127 128
128 PassRefPtr<ArrayBuffer> ArrayBuffer::createOrNull(unsigned numElements, unsigned elementByteSize) 129 PassRefPtr<ArrayBuffer> ArrayBuffer::createOrNull(unsigned numElements, unsigned elementByteSize)
129 { 130 {
130 return createOrNull(numElements, elementByteSize, ArrayBufferContents::ZeroI nitialize); 131 return createOrNull(numElements, elementByteSize, ArrayBufferContents::ZeroI nitialize);
131 } 132 }
132 133
133 PassRefPtr<ArrayBuffer> ArrayBuffer::createUninitialized(unsigned numElements, u nsigned elementByteSize) 134 PassRefPtr<ArrayBuffer> ArrayBuffer::createUninitialized(unsigned numElements, u nsigned elementByteSize)
134 { 135 {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (index < 0) 215 if (index < 0)
215 index = currentLength + index; 216 index = currentLength + index;
216 return clampValue(index, 0, currentLength); 217 return clampValue(index, 0, currentLength);
217 } 218 }
218 219
219 } // namespace WTF 220 } // namespace WTF
220 221
221 using WTF::ArrayBuffer; 222 using WTF::ArrayBuffer;
222 223
223 #endif // ArrayBuffer_h 224 #endif // ArrayBuffer_h
OLDNEW
« no previous file with comments | « no previous file | Source/wtf/ArrayBufferContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698