OLD | NEW |
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 <set> | 5 #include <set> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "components/copresence/copresence_state_impl.h" | 9 #include "components/copresence/copresence_state_impl.h" |
10 #include "components/copresence/proto/data.pb.h" | 10 #include "components/copresence/proto/data.pb.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 observers_, | 94 observers_, |
95 TokenTransmitted(transmitted_tokens_[token.id])); | 95 TokenTransmitted(transmitted_tokens_[token.id])); |
96 } | 96 } |
97 | 97 |
98 // TODO(ckehoe): Check which tokens are no longer heard and report them lost. | 98 // TODO(ckehoe): Check which tokens are no longer heard and report them lost. |
99 void CopresenceStateImpl::UpdateReceivedToken(const ReceivedToken& token) { | 99 void CopresenceStateImpl::UpdateReceivedToken(const ReceivedToken& token) { |
100 DCHECK(!token.id.empty()); | 100 DCHECK(!token.id.empty()); |
101 | 101 |
102 // TODO(ckehoe): Have CopresenceManagerImpl::AudioCheck() use this to check | 102 // TODO(ckehoe): Have CopresenceManagerImpl::AudioCheck() use this to check |
103 // if we can hear our token, and delete the logic from the AudioManager. | 103 // if we can hear our token, and delete the logic from the AudioManager. |
| 104 // TODO(ckehoe): Test that this actually works. |
104 if (transmitted_tokens_.count(token.id) > 0) { | 105 if (transmitted_tokens_.count(token.id) > 0) { |
105 transmitted_tokens_[token.id].broadcast_confirmed = true; | 106 transmitted_tokens_[token.id].broadcast_confirmed = true; |
106 FOR_EACH_OBSERVER(CopresenceObserver, | 107 FOR_EACH_OBSERVER(CopresenceObserver, |
107 observers_, | 108 observers_, |
108 TokenTransmitted(transmitted_tokens_[token.id])); | 109 TokenTransmitted(transmitted_tokens_[token.id])); |
109 } else { | 110 } else { |
110 ReceivedToken& stored_token = received_tokens_[token.id]; | 111 ReceivedToken& stored_token = received_tokens_[token.id]; |
111 UpdateToken(token, &stored_token); | 112 UpdateToken(token, &stored_token); |
112 | 113 |
113 // The decoder doesn't track when this token was heard before, | 114 // The decoder doesn't track when this token was heard before, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (transmitted_tokens_[token].stop_time > now) | 171 if (transmitted_tokens_[token].stop_time > now) |
171 transmitted_tokens_[token].stop_time = now; | 172 transmitted_tokens_[token].stop_time = now; |
172 | 173 |
173 FOR_EACH_OBSERVER(CopresenceObserver, | 174 FOR_EACH_OBSERVER(CopresenceObserver, |
174 observers_, | 175 observers_, |
175 TokenTransmitted(transmitted_tokens_[token])); | 176 TokenTransmitted(transmitted_tokens_[token])); |
176 } | 177 } |
177 } | 178 } |
178 | 179 |
179 } // namespace copresence | 180 } // namespace copresence |
OLD | NEW |