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

Side by Side Diff: webrtc/base/array_view.h

Issue 2429503002: Simplifying audio network adaptor by moving receiver frame length range to ctor. (Closed)
Patch Set: nicer solution Created 4 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 | « no previous file | webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.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 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // e.g. vector<int> will convert to either ArrayView<int> or ArrayView<const 66 // e.g. vector<int> will convert to either ArrayView<int> or ArrayView<const
67 // int>, but const vector<int> will convert only to ArrayView<const int>. 67 // int>, but const vector<int> will convert only to ArrayView<const int>.
68 // (ArrayView itself can be the source type in such conversions, so 68 // (ArrayView itself can be the source type in such conversions, so
69 // ArrayView<int> will convert to ArrayView<const int>.) 69 // ArrayView<int> will convert to ArrayView<const int>.)
70 // 70 //
71 // Note: ArrayView is tiny (just a pointer and a count) and trivially copyable, 71 // Note: ArrayView is tiny (just a pointer and a count) and trivially copyable,
72 // so it's probably cheaper to pass it by value than by const reference. 72 // so it's probably cheaper to pass it by value than by const reference.
73 template <typename T> 73 template <typename T>
74 class ArrayView final { 74 class ArrayView final {
75 public: 75 public:
76 using value_type = T;
77 using const_iterator = const T*;
78
76 // Construct an empty ArrayView. 79 // Construct an empty ArrayView.
77 ArrayView() : ArrayView(static_cast<T*>(nullptr), 0) {} 80 ArrayView() : ArrayView(static_cast<T*>(nullptr), 0) {}
78 ArrayView(std::nullptr_t) : ArrayView() {} 81 ArrayView(std::nullptr_t) : ArrayView() {}
79 82
80 // Construct an ArrayView for a (pointer,size) pair. 83 // Construct an ArrayView for a (pointer,size) pair.
81 template <typename U> 84 template <typename U>
82 ArrayView(U* data, size_t size) 85 ArrayView(U* data, size_t size)
83 : data_(size == 0 ? nullptr : data), size_(size) { 86 : data_(size == 0 ? nullptr : data), size_(size) {
84 CheckInvariant(); 87 CheckInvariant();
85 } 88 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 }; 137 };
135 138
136 template <typename T> 139 template <typename T>
137 inline ArrayView<T> MakeArrayView(T* data, size_t size) { 140 inline ArrayView<T> MakeArrayView(T* data, size_t size) {
138 return ArrayView<T>(data, size); 141 return ArrayView<T>(data, size);
139 } 142 }
140 143
141 } // namespace rtc 144 } // namespace rtc
142 145
143 #endif // WEBRTC_BASE_ARRAY_VIEW_H_ 146 #endif // WEBRTC_BASE_ARRAY_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698