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

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMArrayPiece.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "core/dom/DOMArrayPiece.h" 5 #include "core/dom/DOMArrayPiece.h"
6 6
7 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" 7 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 DOMArrayPiece::DOMArrayPiece( 11 DOMArrayPiece::DOMArrayPiece(
12 const ArrayBufferOrArrayBufferView& arrayBufferOrView, 12 const ArrayBufferOrArrayBufferView& arrayBufferOrView,
13 InitWithUnionOption option) { 13 InitWithUnionOption option) {
14 if (arrayBufferOrView.isArrayBuffer()) { 14 if (arrayBufferOrView.isArrayBuffer()) {
15 DOMArrayBuffer* arrayBuffer = arrayBufferOrView.getAsArrayBuffer(); 15 DOMArrayBuffer* arrayBuffer = arrayBufferOrView.getAsArrayBuffer();
16 initWithData(arrayBuffer->data(), arrayBuffer->byteLength()); 16 initWithData(arrayBuffer->data(), arrayBuffer->byteLength());
17 } else if (arrayBufferOrView.isArrayBufferView()) { 17 } else if (arrayBufferOrView.isArrayBufferView()) {
18 DOMArrayBufferView* arrayBufferView = 18 DOMArrayBufferView* arrayBufferView =
19 arrayBufferOrView.getAsArrayBufferView(); 19 arrayBufferOrView.getAsArrayBufferView().view();
20 initWithData(arrayBufferView->baseAddress(), arrayBufferView->byteLength()); 20 initWithData(arrayBufferView->baseAddress(), arrayBufferView->byteLength());
21 } else if (arrayBufferOrView.isNull() && 21 } else if (arrayBufferOrView.isNull() &&
22 option == AllowNullPointToNullWithZeroSize) { 22 option == AllowNullPointToNullWithZeroSize) {
23 initWithData(nullptr, 0); 23 initWithData(nullptr, 0);
24 } // Otherwise, leave the obejct as null. 24 } // Otherwise, leave the obejct as null.
25 } 25 }
26 26
27 } // namespace blink 27 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698