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

Side by Side Diff: third_party/WebKit/Source/platform/wtf/typed_arrays/TypedArrayBase.h

Issue 2833123002: Replace ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/wtf (Closed)
Patch Set: wtf 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
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBuffer.h ('k') | no next file » | 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) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (c) 2010, Google Inc. All rights reserved. 3 * Copyright (c) 2010, 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 for (unsigned i = 0; i < length; ++i) 81 for (unsigned i = 0; i < length; ++i)
82 a->Set(i, array[i]); 82 a->Set(i, array[i]);
83 return a; 83 return a;
84 } 84 }
85 85
86 template <class Subclass> 86 template <class Subclass>
87 static PassRefPtr<Subclass> Create(PassRefPtr<ArrayBuffer> buffer, 87 static PassRefPtr<Subclass> Create(PassRefPtr<ArrayBuffer> buffer,
88 unsigned byte_offset, 88 unsigned byte_offset,
89 unsigned length) { 89 unsigned length) {
90 RefPtr<ArrayBuffer> buf(std::move(buffer)); 90 RefPtr<ArrayBuffer> buf(std::move(buffer));
91 RELEASE_ASSERT(VerifySubRange<T>(buf, byte_offset, length)); 91 CHECK(VerifySubRange<T>(buf, byte_offset, length));
92 return AdoptRef(new Subclass(buf.Release(), byte_offset, length)); 92 return AdoptRef(new Subclass(buf.Release(), byte_offset, length));
93 } 93 }
94 94
95 template <class Subclass> 95 template <class Subclass>
96 static PassRefPtr<Subclass> CreateOrNull(unsigned length) { 96 static PassRefPtr<Subclass> CreateOrNull(unsigned length) {
97 RefPtr<ArrayBuffer> buffer = ArrayBuffer::CreateOrNull(length, sizeof(T)); 97 RefPtr<ArrayBuffer> buffer = ArrayBuffer::CreateOrNull(length, sizeof(T));
98 if (!buffer) 98 if (!buffer)
99 return nullptr; 99 return nullptr;
100 return Create<Subclass>(buffer.Release(), 0, length); 100 return Create<Subclass>(buffer.Release(), 0, length);
101 } 101 }
102 102
103 void Neuter() final { 103 void Neuter() final {
104 ArrayBufferView::Neuter(); 104 ArrayBufferView::Neuter();
105 length_ = 0; 105 length_ = 0;
106 } 106 }
107 107
108 // We do not want to have to access this via a virtual function in subclasses, 108 // We do not want to have to access this via a virtual function in subclasses,
109 // which is why it is protected rather than private. 109 // which is why it is protected rather than private.
110 unsigned length_; 110 unsigned length_;
111 }; 111 };
112 112
113 } // namespace WTF 113 } // namespace WTF
114 114
115 using WTF::TypedArrayBase; 115 using WTF::TypedArrayBase;
116 116
117 #endif // TypedArrayBase_h 117 #endif // TypedArrayBase_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698