| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include <string.h> | 32 #include <string.h> |
| 33 #include "wtf/FastMalloc.h" | 33 #include "wtf/FastMalloc.h" |
| 34 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 template<typename T> | 38 template<typename T> |
| 39 class AudioArray { | 39 class AudioArray { |
| 40 public: | 40 public: |
| 41 AudioArray() : m_allocation(0), m_alignedData(0), m_size(0) { } | 41 AudioArray() : m_allocation(nullptr), m_alignedData(nullptr), m_size(0) { } |
| 42 explicit AudioArray(size_t n) : m_allocation(0), m_alignedData(0), m_size(0) | 42 explicit AudioArray(size_t n) : m_allocation(nullptr), m_alignedData(nullptr
), m_size(0) |
| 43 { | 43 { |
| 44 allocate(n); | 44 allocate(n); |
| 45 } | 45 } |
| 46 | 46 |
| 47 ~AudioArray() | 47 ~AudioArray() |
| 48 { | 48 { |
| 49 fastFree(m_allocation); | 49 fastFree(m_allocation); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // It's OK to call allocate() multiple times, but data will *not* be copied
from an initial allocation | 52 // It's OK to call allocate() multiple times, but data will *not* be copied
from an initial allocation |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 T* m_alignedData; | 153 T* m_alignedData; |
| 154 size_t m_size; | 154 size_t m_size; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 typedef AudioArray<float> AudioFloatArray; | 157 typedef AudioArray<float> AudioFloatArray; |
| 158 typedef AudioArray<double> AudioDoubleArray; | 158 typedef AudioArray<double> AudioDoubleArray; |
| 159 | 159 |
| 160 } // namespace blink | 160 } // namespace blink |
| 161 | 161 |
| 162 #endif // AudioArray_h | 162 #endif // AudioArray_h |
| OLD | NEW |