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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/Blob.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: add some layout tests Created 3 years, 8 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // static 124 // static
125 void Blob::populateBlobData( 125 void Blob::populateBlobData(
126 BlobData* blobData, 126 BlobData* blobData,
127 const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrUSVString>& parts, 127 const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrUSVString>& parts,
128 bool normalizeLineEndingsToNative) { 128 bool normalizeLineEndingsToNative) {
129 for (const auto& item : parts) { 129 for (const auto& item : parts) {
130 if (item.isArrayBuffer()) { 130 if (item.isArrayBuffer()) {
131 DOMArrayBuffer* arrayBuffer = item.getAsArrayBuffer(); 131 DOMArrayBuffer* arrayBuffer = item.getAsArrayBuffer();
132 blobData->appendBytes(arrayBuffer->data(), arrayBuffer->byteLength()); 132 blobData->appendBytes(arrayBuffer->data(), arrayBuffer->byteLength());
133 } else if (item.isArrayBufferView()) { 133 } else if (item.isArrayBufferView()) {
134 DOMArrayBufferView* arrayBufferView = item.getAsArrayBufferView(); 134 DOMArrayBufferView* arrayBufferView = item.getAsArrayBufferView().view();
135 blobData->appendBytes(arrayBufferView->baseAddress(), 135 blobData->appendBytes(arrayBufferView->baseAddress(),
136 arrayBufferView->byteLength()); 136 arrayBufferView->byteLength());
137 } else if (item.isBlob()) { 137 } else if (item.isBlob()) {
138 item.getAsBlob()->appendTo(*blobData); 138 item.getAsBlob()->appendTo(*blobData);
139 } else if (item.isUSVString()) { 139 } else if (item.isUSVString()) {
140 blobData->appendText(item.getAsUSVString(), normalizeLineEndingsToNative); 140 blobData->appendText(item.getAsUSVString(), normalizeLineEndingsToNative);
141 } else { 141 } else {
142 NOTREACHED(); 142 NOTREACHED();
143 } 143 }
144 } 144 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 const UChar* chars = type.characters16(); 234 const UChar* chars = type.characters16();
235 for (size_t i = 0; i < length; ++i) { 235 for (size_t i = 0; i < length; ++i) {
236 if (chars[i] < 0x0020 || chars[i] > 0x007e) 236 if (chars[i] < 0x0020 || chars[i] > 0x007e)
237 return emptyString; 237 return emptyString;
238 } 238 }
239 } 239 }
240 return type.lower(); 240 return type.lower();
241 } 241 }
242 242
243 } // namespace blink 243 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698