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

Side by Side Diff: content/renderer/media/audio_renderer_sink_cache_impl.cc

Issue 2120273004: Getting rid of AudioHardwareConfig and its synchronous IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to guidou@ changes, dropped unknown frame id and default param caching Created 4 years, 5 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 scoped_refptr<media::AudioRendererSink> AudioRendererSinkCacheImpl::GetSink( 117 scoped_refptr<media::AudioRendererSink> AudioRendererSinkCacheImpl::GetSink(
118 int source_render_frame_id, 118 int source_render_frame_id,
119 const std::string& device_id, 119 const std::string& device_id,
120 const url::Origin& security_origin) { 120 const url::Origin& security_origin) {
121 base::AutoLock auto_lock(cache_lock_); 121 base::AutoLock auto_lock(cache_lock_);
122 122
123 auto cache_iter = 123 auto cache_iter =
124 FindCacheEntry_Locked(source_render_frame_id, device_id, security_origin, 124 FindCacheEntry_Locked(source_render_frame_id, device_id, security_origin,
125 true /* unused_only */); 125 true /* unused sink only */);
126 126
127 if (cache_iter != cache_.end()) { 127 if (cache_iter != cache_.end()) {
128 // Found unused sink; mark it as used and return. 128 // Found unused sink; mark it as used and return.
129 DVLOG(1) << "GetSink: address: " << cache_iter->sink.get() 129 DVLOG(1) << "GetSink: address: " << cache_iter->sink.get()
130 << " - found unused cached sink, reusing it."; 130 << " - found unused cached sink, reusing it.";
131 131
132 cache_iter->used = true; 132 cache_iter->used = true;
133 return cache_iter->sink; 133 return cache_iter->sink;
134 } 134 }
135 135
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 return val.device_id == device_id && 244 return val.device_id == device_id &&
245 val.security_origin == security_origin; 245 val.security_origin == security_origin;
246 }); 246 });
247 }; 247 };
248 248
249 int AudioRendererSinkCacheImpl::GetCacheSizeForTesting() { 249 int AudioRendererSinkCacheImpl::GetCacheSizeForTesting() {
250 return cache_.size(); 250 return cache_.size();
251 } 251 }
252 252
253 } // namespace content 253 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698