| 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/sync_system_resources.h" | 5 #include "components/invalidation/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 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 is_stopped_ = false; | 83 is_stopped_ = false; |
| 84 weak_factory_.InvalidateWeakPtrs(); | 84 weak_factory_.InvalidateWeakPtrs(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SyncInvalidationScheduler::Stop() { | 87 void SyncInvalidationScheduler::Stop() { |
| 88 CHECK_EQ(created_on_loop_, base::MessageLoop::current()); | 88 CHECK_EQ(created_on_loop_, base::MessageLoop::current()); |
| 89 is_stopped_ = true; | 89 is_stopped_ = true; |
| 90 is_started_ = false; | 90 is_started_ = false; |
| 91 weak_factory_.InvalidateWeakPtrs(); | 91 weak_factory_.InvalidateWeakPtrs(); |
| 92 STLDeleteElements(&posted_tasks_); | 92 STLDeleteElements(&posted_tasks_); |
| 93 posted_tasks_.clear(); | |
| 94 } | 93 } |
| 95 | 94 |
| 96 void SyncInvalidationScheduler::Schedule(invalidation::TimeDelta delay, | 95 void SyncInvalidationScheduler::Schedule(invalidation::TimeDelta delay, |
| 97 invalidation::Closure* task) { | 96 invalidation::Closure* task) { |
| 98 DCHECK(invalidation::IsCallbackRepeatable(task)); | 97 DCHECK(invalidation::IsCallbackRepeatable(task)); |
| 99 CHECK_EQ(created_on_loop_, base::MessageLoop::current()); | 98 CHECK_EQ(created_on_loop_, base::MessageLoop::current()); |
| 100 | 99 |
| 101 if (!is_started_) { | 100 if (!is_started_) { |
| 102 delete task; | 101 delete task; |
| 103 return; | 102 return; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 326 |
| 328 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { | 327 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { |
| 329 return internal_scheduler_.get(); | 328 return internal_scheduler_.get(); |
| 330 } | 329 } |
| 331 | 330 |
| 332 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { | 331 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { |
| 333 return listener_scheduler_.get(); | 332 return listener_scheduler_.get(); |
| 334 } | 333 } |
| 335 | 334 |
| 336 } // namespace syncer | 335 } // namespace syncer |
| OLD | NEW |