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

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 missing 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& array_buffer_or_view, 12 const ArrayBufferOrArrayBufferView& array_buffer_or_view,
13 InitWithUnionOption option) { 13 InitWithUnionOption option) {
14 if (array_buffer_or_view.isArrayBuffer()) { 14 if (array_buffer_or_view.isArrayBuffer()) {
15 DOMArrayBuffer* array_buffer = array_buffer_or_view.getAsArrayBuffer(); 15 DOMArrayBuffer* array_buffer = array_buffer_or_view.getAsArrayBuffer();
16 InitWithData(array_buffer->Data(), array_buffer->ByteLength()); 16 InitWithData(array_buffer->Data(), array_buffer->ByteLength());
17 } else if (array_buffer_or_view.isArrayBufferView()) { 17 } else if (array_buffer_or_view.isArrayBufferView()) {
18 DOMArrayBufferView* array_buffer_view = 18 DOMArrayBufferView* array_buffer_view =
19 array_buffer_or_view.getAsArrayBufferView(); 19 array_buffer_or_view.getAsArrayBufferView().View();
20 InitWithData(array_buffer_view->BaseAddress(), 20 InitWithData(array_buffer_view->BaseAddress(),
21 array_buffer_view->byteLength()); 21 array_buffer_view->byteLength());
22 } else if (array_buffer_or_view.isNull() && 22 } else if (array_buffer_or_view.isNull() &&
23 option == kAllowNullPointToNullWithZeroSize) { 23 option == kAllowNullPointToNullWithZeroSize) {
24 InitWithData(nullptr, 0); 24 InitWithData(nullptr, 0);
25 } // Otherwise, leave the obejct as null. 25 } // Otherwise, leave the obejct as null.
26 } 26 }
27 27
28 } // namespace blink 28 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698