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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioBus.cpp

Issue 1916703002: Prepare for move-only PassOwnPtr in the remaining directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@core1
Patch Set: Merge with trunk. Created 4 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
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate) 56 AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate)
57 : m_length(length) 57 : m_length(length)
58 , m_busGain(1) 58 , m_busGain(1)
59 , m_isFirstTime(true) 59 , m_isFirstTime(true)
60 , m_sampleRate(0) 60 , m_sampleRate(0)
61 { 61 {
62 m_channels.reserveInitialCapacity(numberOfChannels); 62 m_channels.reserveInitialCapacity(numberOfChannels);
63 63
64 for (unsigned i = 0; i < numberOfChannels; ++i) { 64 for (unsigned i = 0; i < numberOfChannels; ++i) {
65 PassOwnPtr<AudioChannel> channel = allocate ? adoptPtr(new AudioChannel( length)) : adoptPtr(new AudioChannel(0, length)); 65 PassOwnPtr<AudioChannel> channel = allocate ? adoptPtr(new AudioChannel( length)) : adoptPtr(new AudioChannel(0, length));
66 m_channels.append(channel); 66 m_channels.append(std::move(channel));
67 } 67 }
68 68
69 m_layout = LayoutCanonical; // for now this is the only layout we define 69 m_layout = LayoutCanonical; // for now this is the only layout we define
70 } 70 }
71 71
72 void AudioBus::setChannelMemory(unsigned channelIndex, float* storage, size_t le ngth) 72 void AudioBus::setChannelMemory(unsigned channelIndex, float* storage, size_t le ngth)
73 { 73 {
74 if (channelIndex < m_channels.size()) { 74 if (channelIndex < m_channels.size()) {
75 channel(channelIndex)->set(storage, length); 75 channel(channelIndex)->set(storage, length);
76 m_length = length; // FIXME: verify that this length matches all the oth er channel lengths 76 m_length = length; // FIXME: verify that this length matches all the oth er channel lengths
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 705
706 // If the bus needs no conversion then return as is. 706 // If the bus needs no conversion then return as is.
707 if ((!mixToMono || audioBus->numberOfChannels() == 1) && audioBus->sampleRat e() == sampleRate) 707 if ((!mixToMono || audioBus->numberOfChannels() == 1) && audioBus->sampleRat e() == sampleRate)
708 return audioBus; 708 return audioBus;
709 709
710 return AudioBus::createBySampleRateConverting(audioBus.get(), mixToMono, sam pleRate); 710 return AudioBus::createBySampleRateConverting(audioBus.get(), mixToMono, sam pleRate);
711 } 711 }
712 712
713 } // namespace blink 713 } // namespace blink
714 714
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698