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

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMMatrix.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/DOMMatrix.h" 5 #include "core/dom/DOMMatrix.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState) { 9 DOMMatrix* DOMMatrix::create(ExceptionState& exceptionState) {
10 return new DOMMatrix(TransformationMatrix()); 10 return new DOMMatrix(TransformationMatrix());
(...skipping 21 matching lines...) Expand all
32 ExceptionState& exceptionState) { 32 ExceptionState& exceptionState) {
33 if (sequence.size() != 6 && sequence.size() != 16) { 33 if (sequence.size() != 6 && sequence.size() != 16) {
34 exceptionState.throwTypeError( 34 exceptionState.throwTypeError(
35 "The sequence must contain 6 elements for a 2D matrix or 16 elements " 35 "The sequence must contain 6 elements for a 2D matrix or 16 elements "
36 "for a 3D matrix."); 36 "for a 3D matrix.");
37 return nullptr; 37 return nullptr;
38 } 38 }
39 return new DOMMatrix(sequence, sequence.size()); 39 return new DOMMatrix(sequence, sequence.size());
40 } 40 }
41 41
42 DOMMatrix* DOMMatrix::fromFloat32Array(DOMFloat32Array* float32Array, 42 DOMMatrix* DOMMatrix::fromFloat32Array(
43 ExceptionState& exceptionState) { 43 const MaybeShared<DOMFloat32Array>& maybeShared,
44 ExceptionState& exceptionState) {
45 if (maybeShared.isShared()) {
46 exceptionState.throwTypeError(
47 "The Float32Array must not be backed by a SharedArrayBuffer.");
48 return nullptr;
49 }
50 DOMFloat32Array* float32Array = maybeShared.viewNotShared();
44 if (float32Array->length() != 6 && float32Array->length() != 16) { 51 if (float32Array->length() != 6 && float32Array->length() != 16) {
45 exceptionState.throwTypeError( 52 exceptionState.throwTypeError(
46 "The sequence must contain 6 elements for a 2D matrix or 16 elements " 53 "The sequence must contain 6 elements for a 2D matrix or 16 elements "
47 "for a 3D matrix."); 54 "for a 3D matrix.");
48 return nullptr; 55 return nullptr;
49 } 56 }
50 return new DOMMatrix(float32Array->data(), float32Array->length()); 57 return new DOMMatrix(float32Array->data(), float32Array->length());
51 } 58 }
52 59
53 DOMMatrix* DOMMatrix::fromFloat64Array(DOMFloat64Array* float64Array, 60 DOMMatrix* DOMMatrix::fromFloat64Array(
54 ExceptionState& exceptionState) { 61 const MaybeShared<DOMFloat64Array>& maybeShared,
62 ExceptionState& exceptionState) {
63 if (maybeShared.isShared()) {
64 exceptionState.throwTypeError(
65 "The Float64Array must not be backed by a SharedArrayBuffer.");
66 return nullptr;
67 }
68 DOMFloat64Array* float64Array = maybeShared.viewNotShared();
55 if (float64Array->length() != 6 && float64Array->length() != 16) { 69 if (float64Array->length() != 6 && float64Array->length() != 16) {
56 exceptionState.throwTypeError( 70 exceptionState.throwTypeError(
57 "The sequence must contain 6 elements for a 2D matrix or 16 elements " 71 "The sequence must contain 6 elements for a 2D matrix or 16 elements "
58 "for a 3D matrix."); 72 "for a 3D matrix.");
59 return nullptr; 73 return nullptr;
60 } 74 }
61 return new DOMMatrix(float64Array->data(), float64Array->length()); 75 return new DOMMatrix(float64Array->data(), float64Array->length());
62 } 76 }
63 77
64 template <typename T> 78 template <typename T>
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 return this; 272 return this;
259 } 273 }
260 274
261 DOMMatrix* DOMMatrix::setMatrixValue(const String& inputString, 275 DOMMatrix* DOMMatrix::setMatrixValue(const String& inputString,
262 ExceptionState& exceptionState) { 276 ExceptionState& exceptionState) {
263 setMatrixValueFromString(inputString, exceptionState); 277 setMatrixValueFromString(inputString, exceptionState);
264 return this; 278 return this;
265 } 279 }
266 280
267 } // namespace blink 281 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698