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

Side by Side Diff: Source/core/dom/DOMArrayPiece.h

Issue 1304043002: Make classes and structures in core/dom fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/core/dom/CSSSelectorWatch.h ('k') | Source/core/dom/DOMNodeIds.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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
OLDNEW
« no previous file with comments | « Source/core/dom/CSSSelectorWatch.h ('k') | Source/core/dom/DOMNodeIds.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698