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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/location.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 14 #include "base/single_thread_task_runner.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "base/thread_task_runner_handle.h" |
17 #include "components/invalidation/gcm_network_channel.h" | 19 #include "components/invalidation/gcm_network_channel.h" |
18 #include "components/invalidation/gcm_network_channel_delegate.h" | 20 #include "components/invalidation/gcm_network_channel_delegate.h" |
19 #include "components/invalidation/invalidation_util.h" | 21 #include "components/invalidation/invalidation_util.h" |
20 #include "components/invalidation/push_client_channel.h" | 22 #include "components/invalidation/push_client_channel.h" |
21 #include "google/cacheinvalidation/deps/callback.h" | 23 #include "google/cacheinvalidation/deps/callback.h" |
22 #include "google/cacheinvalidation/include/types.h" | 24 #include "google/cacheinvalidation/include/types.h" |
23 #include "jingle/notifier/listener/push_client.h" | 25 #include "jingle/notifier/listener/push_client.h" |
24 | 26 |
25 namespace syncer { | 27 namespace syncer { |
26 | 28 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 invalidation::Closure* task) { | 98 invalidation::Closure* task) { |
97 DCHECK(invalidation::IsCallbackRepeatable(task)); | 99 DCHECK(invalidation::IsCallbackRepeatable(task)); |
98 CHECK_EQ(created_on_loop_, base::MessageLoop::current()); | 100 CHECK_EQ(created_on_loop_, base::MessageLoop::current()); |
99 | 101 |
100 if (!is_started_) { | 102 if (!is_started_) { |
101 delete task; | 103 delete task; |
102 return; | 104 return; |
103 } | 105 } |
104 | 106 |
105 posted_tasks_.insert(task); | 107 posted_tasks_.insert(task); |
106 base::MessageLoop::current()->PostDelayedTask( | 108 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
107 FROM_HERE, base::Bind(&SyncInvalidationScheduler::RunPostedTask, | 109 FROM_HERE, base::Bind(&SyncInvalidationScheduler::RunPostedTask, |
108 weak_factory_.GetWeakPtr(), task), | 110 weak_factory_.GetWeakPtr(), task), |
109 delay); | 111 delay); |
110 } | 112 } |
111 | 113 |
112 bool SyncInvalidationScheduler::IsRunningOnThread() const { | 114 bool SyncInvalidationScheduler::IsRunningOnThread() const { |
113 return created_on_loop_ == base::MessageLoop::current(); | 115 return created_on_loop_ == base::MessageLoop::current(); |
114 } | 116 } |
115 | 117 |
116 invalidation::Time SyncInvalidationScheduler::GetCurrentTime() const { | 118 invalidation::Time SyncInvalidationScheduler::GetCurrentTime() const { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 328 |
327 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { | 329 SyncInvalidationScheduler* SyncSystemResources::internal_scheduler() { |
328 return internal_scheduler_.get(); | 330 return internal_scheduler_.get(); |
329 } | 331 } |
330 | 332 |
331 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { | 333 SyncInvalidationScheduler* SyncSystemResources::listener_scheduler() { |
332 return listener_scheduler_.get(); | 334 return listener_scheduler_.get(); |
333 } | 335 } |
334 | 336 |
335 } // namespace syncer | 337 } // namespace syncer |
OLD | NEW |