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

Unified Diff: components/copresence/handlers/audio/audio_directive_handler_impl.cc

Issue 1151603003: Fixing race condition in AudioDirectiveHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/handlers/audio/audio_directive_handler_impl.cc
diff --git a/components/copresence/handlers/audio/audio_directive_handler_impl.cc b/components/copresence/handlers/audio/audio_directive_handler_impl.cc
index 09a745be3541cec209dc5f8d6b7045ebaf6cb6d6..9b41629d56d4550157ed26e1ab7ef0bfe3efdf9c 100644
--- a/components/copresence/handlers/audio/audio_directive_handler_impl.cc
+++ b/components/copresence/handlers/audio/audio_directive_handler_impl.cc
@@ -30,12 +30,14 @@ namespace {
base::TimeTicks GetEarliestEventTime(AudioDirectiveList* list,
base::TimeTicks event_time) {
- if (!list->GetActiveDirective())
+ scoped_ptr<AudioDirective> active_directive = list->GetActiveDirective();
+
+ if (!active_directive)
return event_time;
+ if (event_time.is_null())
+ return active_directive->end_time;
- return event_time.is_null() ?
- list->GetActiveDirective()->end_time :
- std::min(list->GetActiveDirective()->end_time, event_time);
+ return std::min(active_directive->end_time, event_time);
}
void ConvertDirectives(const std::vector<AudioDirective>& in_directives,
« 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