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

Side by Side Diff: chrome/browser/renderer_host/audio_renderer_host.cc

Issue 6227003: Avoid a possible race between entry deletion and a command, in the event a... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/audio_renderer_host.h" 5 #include "chrome/browser/renderer_host/audio_renderer_host.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/process.h" 8 #include "base/process.h"
9 #include "base/shared_memory.h" 9 #include "base/shared_memory.h"
10 #include "chrome/browser/renderer_host/audio_sync_reader.h" 10 #include "chrome/browser/renderer_host/audio_sync_reader.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 SendErrorMessage(entry->render_view_id, entry->stream_id); 453 SendErrorMessage(entry->render_view_id, entry->stream_id);
454 CloseAndDeleteStream(entry); 454 CloseAndDeleteStream(entry);
455 } 455 }
456 456
457 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById( 457 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(
458 int route_id, int stream_id) { 458 int route_id, int stream_id) {
459 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 459 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
460 460
461 AudioEntryMap::iterator i = audio_entries_.find( 461 AudioEntryMap::iterator i = audio_entries_.find(
462 AudioEntryId(route_id, stream_id)); 462 AudioEntryId(route_id, stream_id));
463 if (i != audio_entries_.end()) 463 if (i != audio_entries_.end() && !i->second->pending_close)
464 return i->second; 464 return i->second;
465 return NULL; 465 return NULL;
466 } 466 }
467 467
468 AudioRendererHost::AudioEntry* AudioRendererHost::LookupByController( 468 AudioRendererHost::AudioEntry* AudioRendererHost::LookupByController(
469 media::AudioOutputController* controller) { 469 media::AudioOutputController* controller) {
470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
471 471
472 // Iterate the map of entries. 472 // Iterate the map of entries.
473 // TODO(hclam): Implement a faster look up method. 473 // TODO(hclam): Implement a faster look up method.
474 for (AudioEntryMap::iterator i = audio_entries_.begin(); 474 for (AudioEntryMap::iterator i = audio_entries_.begin();
475 i != audio_entries_.end(); ++i) { 475 i != audio_entries_.end(); ++i) {
476 if (controller == i->second->controller.get()) 476 if (!i->second->pending_close && controller == i->second->controller.get())
477 return i->second; 477 return i->second;
478 } 478 }
479 return NULL; 479 return NULL;
480 } 480 }
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