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

Side by Side Diff: webkit/glue/plugins/pepper_audio.cc

Issue 5522003: Fix a race condition in proxied audio.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_audio.h" 5 #include "webkit/glue/plugins/pepper_audio.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/dev/ppb_audio_dev.h" 8 #include "ppapi/c/dev/ppb_audio_dev.h"
9 #include "ppapi/c/dev/ppb_audio_trusted_dev.h" 9 #include "ppapi/c/dev/ppb_audio_trusted_dev.h"
10 #include "ppapi/c/pp_completion_callback.h" 10 #include "ppapi/c/pp_completion_callback.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // this case we don't need to map any data or start the thread since it 329 // this case we don't need to map any data or start the thread since it
330 // will be handled by the proxy. 330 // will be handled by the proxy.
331 shared_memory_for_create_callback_.reset( 331 shared_memory_for_create_callback_.reset(
332 new base::SharedMemory(shared_memory_handle, false)); 332 new base::SharedMemory(shared_memory_handle, false));
333 shared_memory_size_for_create_callback_ = shared_memory_size; 333 shared_memory_size_for_create_callback_ = shared_memory_size;
334 socket_for_create_callback_.reset(new base::SyncSocket(socket_handle)); 334 socket_for_create_callback_.reset(new base::SyncSocket(socket_handle));
335 335
336 PP_RunCompletionCallback(&create_callback_, 0); 336 PP_RunCompletionCallback(&create_callback_, 0);
337 create_callback_pending_ = false; 337 create_callback_pending_ = false;
338 338
339 // Close the handles now that this process is done with them. 339 // It might be nice to close the handles here to free up some system
340 shared_memory_for_create_callback_.reset(); 340 // resources, but we can't since there's a race condition. The handles must
341 shared_memory_size_for_create_callback_ = 0; 341 // be valid until they're sent over IPC, which is done from the I/O thread
342 socket_for_create_callback_.reset(); 342 // which will often get done after this code executes. We could do
343 // something more elaborate like an ACK from the plugin or post a task to
344 // the I/O thread and back, but this extra complexity doesn't seem worth it
345 // just to clean up these handles faster.
343 } else { 346 } else {
344 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); 347 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle);
345 } 348 }
346 } 349 }
347 350
348 } // namespace pepper 351 } // namespace pepper
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698