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

Side by Side Diff: third_party/WebKit/Source/wtf/Int32Array.h

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month 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 | « third_party/WebKit/Source/wtf/Int16Array.h ('k') | third_party/WebKit/Source/wtf/Int8Array.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 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 15 matching lines...) Expand all
26 26
27 #ifndef Int32Array_h 27 #ifndef Int32Array_h
28 #define Int32Array_h 28 #define Int32Array_h
29 29
30 #include "wtf/IntegralTypedArrayBase.h" 30 #include "wtf/IntegralTypedArrayBase.h"
31 31
32 namespace WTF { 32 namespace WTF {
33 33
34 class Int32Array final : public IntegralTypedArrayBase<int> { 34 class Int32Array final : public IntegralTypedArrayBase<int> {
35 public: 35 public:
36 static inline PassRefPtr<Int32Array> create(unsigned length); 36 static inline PassRefPtr<Int32Array> createOrNull(unsigned length);
37 static inline PassRefPtr<Int32Array> create(const int* array, unsigned lengt h); 37 static inline PassRefPtr<Int32Array> createOrNull(const int* array, unsigned length);
38 static inline PassRefPtr<Int32Array> deprecatedCreateOrCrash(const int* arra y, unsigned length);
38 static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigne d byteOffset, unsigned length); 39 static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigne d byteOffset, unsigned length);
39 40
40 using TypedArrayBase<int>::set; 41 using TypedArrayBase<int>::set;
41 using IntegralTypedArrayBase<int>::set; 42 using IntegralTypedArrayBase<int>::set;
42 43
43 ViewType type() const override 44 ViewType type() const override
44 { 45 {
45 return TypeInt32; 46 return TypeInt32;
46 } 47 }
47 48
48 private: 49 private:
49 inline Int32Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned len gth); 50 inline Int32Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned len gth);
50 // Make constructor visible to superclass. 51 // Make constructor visible to superclass.
51 friend class TypedArrayBase<int>; 52 friend class TypedArrayBase<int>;
52 }; 53 };
53 54
54 PassRefPtr<Int32Array> Int32Array::create(unsigned length) 55 PassRefPtr<Int32Array> Int32Array::createOrNull(unsigned length)
55 { 56 {
56 return TypedArrayBase<int>::create<Int32Array>(length); 57 return TypedArrayBase<int>::createOrNull<Int32Array>(length);
57 } 58 }
58 59
59 PassRefPtr<Int32Array> Int32Array::create(const int* array, unsigned length) 60 PassRefPtr<Int32Array> Int32Array::createOrNull(const int* array, unsigned lengt h)
60 { 61 {
61 return TypedArrayBase<int>::create<Int32Array>(array, length); 62 return TypedArrayBase<int>::createOrNull<Int32Array>(array, length);
63 }
64
65 PassRefPtr<Int32Array> Int32Array::deprecatedCreateOrCrash(const int* array, uns igned length)
66 {
67 return TypedArrayBase<int>::deprecatedCreateOrCrash<Int32Array>(array, lengt h);
62 } 68 }
63 69
64 PassRefPtr<Int32Array> Int32Array::create(PassRefPtr<ArrayBuffer> buffer, unsign ed byteOffset, unsigned length) 70 PassRefPtr<Int32Array> Int32Array::create(PassRefPtr<ArrayBuffer> buffer, unsign ed byteOffset, unsigned length)
65 { 71 {
66 return TypedArrayBase<int>::create<Int32Array>(buffer, byteOffset, length); 72 return TypedArrayBase<int>::create<Int32Array>(buffer, byteOffset, length);
67 } 73 }
68 74
69 Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi gned length) 75 Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi gned length)
70 : IntegralTypedArrayBase<int>(buffer, byteOffset, length) 76 : IntegralTypedArrayBase<int>(buffer, byteOffset, length)
71 { 77 {
72 } 78 }
73 79
74 } // namespace WTF 80 } // namespace WTF
75 81
76 using WTF::Int32Array; 82 using WTF::Int32Array;
77 83
78 #endif // Int32Array_h 84 #endif // Int32Array_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/Int16Array.h ('k') | third_party/WebKit/Source/wtf/Int8Array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698