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

Side by Side Diff: components/copresence/handlers/audio/audio_directive_list.cc

Issue 670623002: Change base::TickClock to a ref counted class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_redesign
Patch Set: y Created 6 years, 2 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 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 "components/copresence/handlers/audio/audio_directive_list.h" 5 #include "components/copresence/handlers/audio/audio_directive_list.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/default_tick_clock.h" 10 #include "base/time/default_tick_clock.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 active_directives_.front().end_time < clock_->NowTicks()) { 68 active_directives_.front().end_time < clock_->NowTicks()) {
69 active_directives_.clear(); 69 active_directives_.clear();
70 } 70 }
71 71
72 if (active_directives_.empty()) 72 if (active_directives_.empty())
73 return make_scoped_ptr<AudioDirective>(NULL); 73 return make_scoped_ptr<AudioDirective>(NULL);
74 74
75 return make_scoped_ptr(new AudioDirective(active_directives_.front())); 75 return make_scoped_ptr(new AudioDirective(active_directives_.front()));
76 } 76 }
77 77
78 void AudioDirectiveList::set_clock_for_testing(
79 const scoped_refptr<base::TickClock>& clock) {
80 clock_ = clock;
81 }
82
83 // Private methods.
84
78 std::vector<AudioDirective>::iterator AudioDirectiveList::FindDirectiveByOpId( 85 std::vector<AudioDirective>::iterator AudioDirectiveList::FindDirectiveByOpId(
79 const std::string& op_id) { 86 const std::string& op_id) {
80 for (std::vector<AudioDirective>::iterator it = active_directives_.begin(); 87 for (std::vector<AudioDirective>::iterator it = active_directives_.begin();
81 it != active_directives_.end(); 88 it != active_directives_.end();
82 ++it) { 89 ++it) {
83 if (it->op_id == op_id) 90 if (it->op_id == op_id)
84 return it; 91 return it;
85 } 92 }
86 return active_directives_.end(); 93 return active_directives_.end();
87 } 94 }
88 95
89 } // namespace copresence 96 } // namespace copresence
OLDNEW
« no previous file with comments | « components/copresence/handlers/audio/audio_directive_list.h ('k') | components/copresence/timed_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698