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

Side by Side Diff: ppapi/proxy/media_stream_audio_track_resource.cc

Issue 1864293002: Convert //ppapi to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more nullptr 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
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/proxy/media_stream_track_resource_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ppapi/proxy/media_stream_audio_track_resource.h" 5 #include "ppapi/proxy/media_stream_audio_track_resource.h"
6 6
7 #include "ppapi/proxy/audio_buffer_resource.h" 7 #include "ppapi/proxy/audio_buffer_resource.h"
8 #include "ppapi/proxy/ppapi_messages.h" 8 #include "ppapi/proxy/ppapi_messages.h"
9 #include "ppapi/shared_impl/media_stream_audio_track_shared.h" 9 #include "ppapi/shared_impl/media_stream_audio_track_shared.h"
10 #include "ppapi/shared_impl/media_stream_buffer.h" 10 #include "ppapi/shared_impl/media_stream_buffer.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 PP_Resource MediaStreamAudioTrackResource::GetAudioBuffer() { 164 PP_Resource MediaStreamAudioTrackResource::GetAudioBuffer() {
165 int32_t index = buffer_manager()->DequeueBuffer(); 165 int32_t index = buffer_manager()->DequeueBuffer();
166 if (index < 0) 166 if (index < 0)
167 return 0; 167 return 0;
168 168
169 MediaStreamBuffer* buffer = buffer_manager()->GetBufferPointer(index); 169 MediaStreamBuffer* buffer = buffer_manager()->GetBufferPointer(index);
170 DCHECK(buffer); 170 DCHECK(buffer);
171 scoped_refptr<AudioBufferResource> resource = 171 scoped_refptr<AudioBufferResource> resource =
172 new AudioBufferResource(pp_instance(), index, buffer); 172 new AudioBufferResource(pp_instance(), index, buffer);
173 // Add |pp_resource()| and |resource| into |buffers_|. 173 // Add |pp_resource()| and |resource| into |buffers_|.
174 // |buffers_| uses scoped_ptr<> to hold a ref of |resource|. It keeps the 174 // |buffers_| uses std::unique_ptr<> to hold a ref of |resource|. It keeps the
175 // resource alive. 175 // resource alive.
176 buffers_.insert(BufferMap::value_type(resource->pp_resource(), resource)); 176 buffers_.insert(BufferMap::value_type(resource->pp_resource(), resource));
177 return resource->GetReference(); 177 return resource->GetReference();
178 } 178 }
179 179
180 void MediaStreamAudioTrackResource::ReleaseBuffers() { 180 void MediaStreamAudioTrackResource::ReleaseBuffers() {
181 for (BufferMap::iterator it = buffers_.begin(); it != buffers_.end(); ++it) { 181 for (BufferMap::iterator it = buffers_.begin(); it != buffers_.end(); ++it) {
182 // Just invalidate and release VideoBufferResorce, but keep PP_Resource. 182 // Just invalidate and release VideoBufferResorce, but keep PP_Resource.
183 // So plugin can still use |RecycleBuffer()|. 183 // So plugin can still use |RecycleBuffer()|.
184 it->second->Invalidate(); 184 it->second->Invalidate();
185 it->second = NULL; 185 it->second = NULL;
186 } 186 }
187 } 187 }
188 188
189 void MediaStreamAudioTrackResource::OnPluginMsgConfigureReply( 189 void MediaStreamAudioTrackResource::OnPluginMsgConfigureReply(
190 const ResourceMessageReplyParams& params) { 190 const ResourceMessageReplyParams& params) {
191 if (TrackedCallback::IsPending(configure_callback_)) { 191 if (TrackedCallback::IsPending(configure_callback_)) {
192 scoped_refptr<TrackedCallback> callback; 192 scoped_refptr<TrackedCallback> callback;
193 callback.swap(configure_callback_); 193 callback.swap(configure_callback_);
194 callback->Run(params.result()); 194 callback->Run(params.result());
195 } 195 }
196 } 196 }
197 197
198 } // namespace proxy 198 } // namespace proxy
199 } // namespace ppapi 199 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/proxy/media_stream_track_resource_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698