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

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

Issue 691223002: Replacing NULL with nullptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using EXPECT_THAT Created 6 years, 1 month 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 | « no previous file | components/copresence/handlers/audio/audio_directive_list_unittest.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 "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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 scoped_ptr<AudioDirective> AudioDirectiveList::GetActiveDirective() { 65 scoped_ptr<AudioDirective> AudioDirectiveList::GetActiveDirective() {
66 // The top is always the instruction that is ending the latest. If that time 66 // The top is always the instruction that is ending the latest. If that time
67 // has passed, means all our previous instructions have expired too, hence 67 // has passed, means all our previous instructions have expired too, hence
68 // clear the list. 68 // clear the list.
69 if (!active_directives_.empty() && 69 if (!active_directives_.empty() &&
70 active_directives_.front().end_time < clock_->NowTicks()) { 70 active_directives_.front().end_time < clock_->NowTicks()) {
71 active_directives_.clear(); 71 active_directives_.clear();
72 } 72 }
73 73
74 if (active_directives_.empty()) 74 if (active_directives_.empty())
75 return make_scoped_ptr<AudioDirective>(NULL); 75 return scoped_ptr<AudioDirective>().Pass();
76 76
77 return make_scoped_ptr(new AudioDirective(active_directives_.front())); 77 return make_scoped_ptr(new AudioDirective(active_directives_.front()));
78 } 78 }
79 79
80 void AudioDirectiveList::set_clock_for_testing( 80 void AudioDirectiveList::set_clock_for_testing(
81 const scoped_refptr<TickClockRefCounted>& clock) { 81 const scoped_refptr<TickClockRefCounted>& clock) {
82 clock_ = clock; 82 clock_ = clock;
83 } 83 }
84 84
85 // Private methods. 85 // Private methods.
86 86
87 std::vector<AudioDirective>::iterator AudioDirectiveList::FindDirectiveByOpId( 87 std::vector<AudioDirective>::iterator AudioDirectiveList::FindDirectiveByOpId(
88 const std::string& op_id) { 88 const std::string& op_id) {
89 for (std::vector<AudioDirective>::iterator it = active_directives_.begin(); 89 for (std::vector<AudioDirective>::iterator it = active_directives_.begin();
90 it != active_directives_.end(); 90 it != active_directives_.end();
91 ++it) { 91 ++it) {
92 if (it->op_id == op_id) 92 if (it->op_id == op_id)
93 return it; 93 return it;
94 } 94 }
95 return active_directives_.end(); 95 return active_directives_.end();
96 } 96 }
97 97
98 } // namespace copresence 98 } // namespace copresence
OLDNEW
« no previous file with comments | « no previous file | components/copresence/handlers/audio/audio_directive_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698