| 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 "components/invalidation/impl/sync_system_resources.h" | 5 #include "components/invalidation/impl/sync_system_resources.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 is_started_ = true; | 86 is_started_ = true; |
| 87 is_stopped_ = false; | 87 is_stopped_ = false; |
| 88 weak_factory_.InvalidateWeakPtrs(); | 88 weak_factory_.InvalidateWeakPtrs(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SyncInvalidationScheduler::Stop() { | 91 void SyncInvalidationScheduler::Stop() { |
| 92 CHECK(IsRunningOnThread()); | 92 CHECK(IsRunningOnThread()); |
| 93 is_stopped_ = true; | 93 is_stopped_ = true; |
| 94 is_started_ = false; | 94 is_started_ = false; |
| 95 weak_factory_.InvalidateWeakPtrs(); | 95 weak_factory_.InvalidateWeakPtrs(); |
| 96 STLDeleteElements(&posted_tasks_); | 96 base::STLDeleteElements(&posted_tasks_); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void SyncInvalidationScheduler::Schedule(invalidation::TimeDelta delay, | 99 void SyncInvalidationScheduler::Schedule(invalidation::TimeDelta delay, |
| 100 invalidation::Closure* task) { | 100 invalidation::Closure* task) { |
| 101 DCHECK(invalidation::IsCallbackRepeatable(task)); | 101 DCHECK(invalidation::IsCallbackRepeatable(task)); |
| 102 CHECK(IsRunningOnThread()); | 102 CHECK(IsRunningOnThread()); |
| 103 | 103 |
| 104 if (!is_started_) { | 104 if (!is_started_) { |
| 105 delete task; | 105 delete task; |
| 106 return; | 106 return; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 132 task->Run(); | 132 task->Run(); |
| 133 posted_tasks_.erase(task); | 133 posted_tasks_.erase(task); |
| 134 delete task; | 134 delete task; |
| 135 } | 135 } |
| 136 | 136 |
| 137 SyncNetworkChannel::SyncNetworkChannel() | 137 SyncNetworkChannel::SyncNetworkChannel() |
| 138 : last_network_status_(false), | 138 : last_network_status_(false), |
| 139 received_messages_count_(0) {} | 139 received_messages_count_(0) {} |
| 140 | 140 |
| 141 SyncNetworkChannel::~SyncNetworkChannel() { | 141 SyncNetworkChannel::~SyncNetworkChannel() { |
| 142 STLDeleteElements(&network_status_receivers_); | 142 base::STLDeleteElements(&network_status_receivers_); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void SyncNetworkChannel::SetMessageReceiver( | 145 void SyncNetworkChannel::SetMessageReceiver( |
| 146 invalidation::MessageCallback* incoming_receiver) { | 146 invalidation::MessageCallback* incoming_receiver) { |
| 147 incoming_receiver_.reset(incoming_receiver); | 147 incoming_receiver_.reset(incoming_receiver); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void SyncNetworkChannel::AddNetworkStatusReceiver( | 150 void SyncNetworkChannel::AddNetworkStatusReceiver( |
| 151 invalidation::NetworkStatusCallback* network_status_receiver) { | 151 invalidation::NetworkStatusCallback* network_status_receiver) { |
| 152 network_status_receiver->Run(last_network_status_); | 152 network_status_receiver->Run(last_network_status_); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { | 330 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { |
| 331 return internal_scheduler_.get(); | 331 return internal_scheduler_.get(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { | 334 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { |
| 335 return listener_scheduler_.get(); | 335 return listener_scheduler_.get(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace syncer | 338 } // namespace syncer |
| OLD | NEW |