| 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 audio_bus->SetSampleRate(sample_rate); | 41 audio_bus->SetSampleRate(sample_rate); |
| 42 | 42 |
| 43 if (private_) | 43 if (private_) |
| 44 (static_cast<AudioBus*>(private_))->Deref(); | 44 (static_cast<AudioBus*>(private_))->Deref(); |
| 45 | 45 |
| 46 audio_bus->Ref(); | 46 audio_bus->Ref(); |
| 47 private_ = static_cast<WebAudioBusPrivate*>(audio_bus.Get()); | 47 private_ = static_cast<WebAudioBusPrivate*>(audio_bus.Get()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void WebAudioBus::ResizeSmaller(size_t new_length) { | 50 void WebAudioBus::ResizeSmaller(size_t new_length) { |
| 51 ASSERT(private_); | 51 DCHECK(private_); |
| 52 if (private_) { | 52 if (private_) { |
| 53 ASSERT(new_length <= length()); | 53 DCHECK_LE(new_length, length()); |
| 54 private_->ResizeSmaller(new_length); | 54 private_->ResizeSmaller(new_length); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 void WebAudioBus::Reset() { | 58 void WebAudioBus::Reset() { |
| 59 if (private_) { | 59 if (private_) { |
| 60 (static_cast<AudioBus*>(private_))->Deref(); | 60 (static_cast<AudioBus*>(private_))->Deref(); |
| 61 private_ = 0; | 61 private_ = 0; |
| 62 } | 62 } |
| 63 } | 63 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 76 | 76 |
| 77 double WebAudioBus::SampleRate() const { | 77 double WebAudioBus::SampleRate() const { |
| 78 if (!private_) | 78 if (!private_) |
| 79 return 0; | 79 return 0; |
| 80 return private_->SampleRate(); | 80 return private_->SampleRate(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 float* WebAudioBus::ChannelData(unsigned channel_index) { | 83 float* WebAudioBus::ChannelData(unsigned channel_index) { |
| 84 if (!private_) | 84 if (!private_) |
| 85 return 0; | 85 return 0; |
| 86 ASSERT(channel_index < NumberOfChannels()); | 86 DCHECK_LT(channel_index, NumberOfChannels()); |
| 87 return private_->Channel(channel_index)->MutableData(); | 87 return private_->Channel(channel_index)->MutableData(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 PassRefPtr<AudioBus> WebAudioBus::Release() { | 90 PassRefPtr<AudioBus> WebAudioBus::Release() { |
| 91 RefPtr<AudioBus> audio_bus(AdoptRef(static_cast<AudioBus*>(private_))); | 91 RefPtr<AudioBus> audio_bus(AdoptRef(static_cast<AudioBus*>(private_))); |
| 92 private_ = 0; | 92 private_ = 0; |
| 93 return audio_bus; | 93 return audio_bus; |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |