| OLD | NEW |
| 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 #ifndef DOMArrayPiece_h | 5 #ifndef DOMArrayPiece_h |
| 6 #define DOMArrayPiece_h | 6 #define DOMArrayPiece_h |
| 7 | 7 |
| 8 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
| 9 #include "core/dom/DOMArrayBufferView.h" | 9 #include "core/dom/DOMArrayBufferView.h" |
| 10 #include "wtf/ArrayPiece.h" | 10 #include "wtf/ArrayPiece.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class ArrayBufferOrArrayBufferView; | 14 class ArrayBufferOrArrayBufferView; |
| 15 | 15 |
| 16 // This class is for passing around un-owned bytes as a pointer + length. | 16 // This class is for passing around un-owned bytes as a pointer + length. |
| 17 // It supports implicit conversion from several other data types. | 17 // It supports implicit conversion from several other data types. |
| 18 // | 18 // |
| 19 // ArrayPiece has the concept of being "null". This is different from an empty | 19 // ArrayPiece has the concept of being "null". This is different from an empty |
| 20 // byte range. It is invalid to call methods other than isNull() on such | 20 // byte range. It is invalid to call methods other than isNull() on such |
| 21 // instances. | 21 // instances. |
| 22 // | 22 // |
| 23 // IMPORTANT: The data contained by ArrayPiece is NOT OWNED, so caution must be | 23 // IMPORTANT: The data contained by ArrayPiece is NOT OWNED, so caution must be |
| 24 // taken to ensure it is kept alive. | 24 // taken to ensure it is kept alive. |
| 25 class CORE_EXPORT DOMArrayPiece : public WTF::ArrayPiece { | 25 class CORE_EXPORT DOMArrayPiece : public WTF::ArrayPiece { |
| 26 DISALLOW_ALLOCATION(); |
| 26 public: | 27 public: |
| 27 enum InitWithUnionOption { | 28 enum InitWithUnionOption { |
| 28 // Initialize this object as "null" when initialized with an union which | 29 // Initialize this object as "null" when initialized with an union which |
| 29 // holds null. | 30 // holds null. |
| 30 TreatNullAsNull, | 31 TreatNullAsNull, |
| 31 // Initialize this object so this points to null pointer with zero size | 32 // Initialize this object so this points to null pointer with zero size |
| 32 // when initialized with an union which holds null. | 33 // when initialized with an union which holds null. |
| 33 AllowNullPointToNullWithZeroSize, | 34 AllowNullPointToNullWithZeroSize, |
| 34 }; | 35 }; |
| 35 | 36 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 47 | 48 |
| 48 bool operator==(const DOMArrayBufferView& other) const | 49 bool operator==(const DOMArrayBufferView& other) const |
| 49 { | 50 { |
| 50 return byteLength() == other.byteLength() && memcmp(data(), other.baseAd
dress(), byteLength()) == 0; | 51 return byteLength() == other.byteLength() && memcmp(data(), other.baseAd
dress(), byteLength()) == 0; |
| 51 } | 52 } |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace blink | 55 } // namespace blink |
| 55 | 56 |
| 56 #endif // DOMArrayPiece_h | 57 #endif // DOMArrayPiece_h |
| OLD | NEW |