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

Side by Side Diff: jingle/notifier/listener/non_blocking_push_client.cc

Issue 2283373002: Remove unneeded scoped_refptr<>::get() on method binding (Closed)
Patch Set: Created 4 years, 3 months 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 | « ipc/ipc_sync_channel.cc ('k') | net/base/test_completion_callback_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "jingle/notifier/listener/non_blocking_push_client.h" 5 #include "jingle/notifier/listener/non_blocking_push_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 NonBlockingPushClient::NonBlockingPushClient( 154 NonBlockingPushClient::NonBlockingPushClient(
155 const scoped_refptr<base::SingleThreadTaskRunner>& delegate_task_runner, 155 const scoped_refptr<base::SingleThreadTaskRunner>& delegate_task_runner,
156 const CreateBlockingPushClientCallback& 156 const CreateBlockingPushClientCallback&
157 create_blocking_push_client_callback) 157 create_blocking_push_client_callback)
158 : delegate_task_runner_(delegate_task_runner), 158 : delegate_task_runner_(delegate_task_runner),
159 weak_ptr_factory_(this) { 159 weak_ptr_factory_(this) {
160 core_ = new Core(delegate_task_runner_, weak_ptr_factory_.GetWeakPtr()); 160 core_ = new Core(delegate_task_runner_, weak_ptr_factory_.GetWeakPtr());
161 delegate_task_runner_->PostTask( 161 delegate_task_runner_->PostTask(
162 FROM_HERE, 162 FROM_HERE,
163 base::Bind(&NonBlockingPushClient::Core::CreateOnDelegateThread, 163 base::Bind(&NonBlockingPushClient::Core::CreateOnDelegateThread,
164 core_.get(), create_blocking_push_client_callback)); 164 core_, create_blocking_push_client_callback));
165 } 165 }
166 166
167 NonBlockingPushClient::~NonBlockingPushClient() { 167 NonBlockingPushClient::~NonBlockingPushClient() {
168 DCHECK(thread_checker_.CalledOnValidThread()); 168 DCHECK(thread_checker_.CalledOnValidThread());
169 delegate_task_runner_->PostTask( 169 delegate_task_runner_->PostTask(
170 FROM_HERE, 170 FROM_HERE,
171 base::Bind(&NonBlockingPushClient::Core::DestroyOnDelegateThread, 171 base::Bind(&NonBlockingPushClient::Core::DestroyOnDelegateThread,
172 core_.get())); 172 core_));
173 } 173 }
174 174
175 void NonBlockingPushClient::AddObserver(PushClientObserver* observer) { 175 void NonBlockingPushClient::AddObserver(PushClientObserver* observer) {
176 DCHECK(thread_checker_.CalledOnValidThread()); 176 DCHECK(thread_checker_.CalledOnValidThread());
177 observers_.AddObserver(observer); 177 observers_.AddObserver(observer);
178 } 178 }
179 179
180 void NonBlockingPushClient::RemoveObserver(PushClientObserver* observer) { 180 void NonBlockingPushClient::RemoveObserver(PushClientObserver* observer) {
181 DCHECK(thread_checker_.CalledOnValidThread()); 181 DCHECK(thread_checker_.CalledOnValidThread());
182 observers_.RemoveObserver(observer); 182 observers_.RemoveObserver(observer);
183 } 183 }
184 184
185 void NonBlockingPushClient::UpdateSubscriptions( 185 void NonBlockingPushClient::UpdateSubscriptions(
186 const SubscriptionList& subscriptions) { 186 const SubscriptionList& subscriptions) {
187 DCHECK(thread_checker_.CalledOnValidThread()); 187 DCHECK(thread_checker_.CalledOnValidThread());
188 delegate_task_runner_->PostTask( 188 delegate_task_runner_->PostTask(
189 FROM_HERE, 189 FROM_HERE,
190 base::Bind(&NonBlockingPushClient::Core::UpdateSubscriptions, 190 base::Bind(&NonBlockingPushClient::Core::UpdateSubscriptions,
191 core_.get(), subscriptions)); 191 core_, subscriptions));
192 } 192 }
193 193
194 void NonBlockingPushClient::UpdateCredentials( 194 void NonBlockingPushClient::UpdateCredentials(
195 const std::string& email, const std::string& token) { 195 const std::string& email, const std::string& token) {
196 DCHECK(thread_checker_.CalledOnValidThread()); 196 DCHECK(thread_checker_.CalledOnValidThread());
197 delegate_task_runner_->PostTask( 197 delegate_task_runner_->PostTask(
198 FROM_HERE, 198 FROM_HERE,
199 base::Bind(&NonBlockingPushClient::Core::UpdateCredentials, 199 base::Bind(&NonBlockingPushClient::Core::UpdateCredentials,
200 core_.get(), email, token)); 200 core_, email, token));
201 } 201 }
202 202
203 void NonBlockingPushClient::SendNotification( 203 void NonBlockingPushClient::SendNotification(
204 const Notification& notification) { 204 const Notification& notification) {
205 DCHECK(thread_checker_.CalledOnValidThread()); 205 DCHECK(thread_checker_.CalledOnValidThread());
206 delegate_task_runner_->PostTask( 206 delegate_task_runner_->PostTask(
207 FROM_HERE, 207 FROM_HERE,
208 base::Bind(&NonBlockingPushClient::Core::SendNotification, core_.get(), 208 base::Bind(&NonBlockingPushClient::Core::SendNotification, core_,
209 notification)); 209 notification));
210 } 210 }
211 211
212 void NonBlockingPushClient::SendPing() { 212 void NonBlockingPushClient::SendPing() {
213 DCHECK(thread_checker_.CalledOnValidThread()); 213 DCHECK(thread_checker_.CalledOnValidThread());
214 delegate_task_runner_->PostTask( 214 delegate_task_runner_->PostTask(
215 FROM_HERE, 215 FROM_HERE,
216 base::Bind(&NonBlockingPushClient::Core::SendPing, core_.get())); 216 base::Bind(&NonBlockingPushClient::Core::SendPing, core_));
217 } 217 }
218 218
219 void NonBlockingPushClient::OnNotificationsEnabled() { 219 void NonBlockingPushClient::OnNotificationsEnabled() {
220 DCHECK(thread_checker_.CalledOnValidThread()); 220 DCHECK(thread_checker_.CalledOnValidThread());
221 FOR_EACH_OBSERVER(PushClientObserver, observers_, 221 FOR_EACH_OBSERVER(PushClientObserver, observers_,
222 OnNotificationsEnabled()); 222 OnNotificationsEnabled());
223 } 223 }
224 224
225 void NonBlockingPushClient::OnNotificationsDisabled( 225 void NonBlockingPushClient::OnNotificationsDisabled(
226 NotificationsDisabledReason reason) { 226 NotificationsDisabledReason reason) {
227 DCHECK(thread_checker_.CalledOnValidThread()); 227 DCHECK(thread_checker_.CalledOnValidThread());
228 FOR_EACH_OBSERVER(PushClientObserver, observers_, 228 FOR_EACH_OBSERVER(PushClientObserver, observers_,
229 OnNotificationsDisabled(reason)); 229 OnNotificationsDisabled(reason));
230 } 230 }
231 231
232 void NonBlockingPushClient::OnIncomingNotification( 232 void NonBlockingPushClient::OnIncomingNotification(
233 const Notification& notification) { 233 const Notification& notification) {
234 DCHECK(thread_checker_.CalledOnValidThread()); 234 DCHECK(thread_checker_.CalledOnValidThread());
235 FOR_EACH_OBSERVER(PushClientObserver, observers_, 235 FOR_EACH_OBSERVER(PushClientObserver, observers_,
236 OnIncomingNotification(notification)); 236 OnIncomingNotification(notification));
237 } 237 }
238 238
239 void NonBlockingPushClient::OnPingResponse() { 239 void NonBlockingPushClient::OnPingResponse() {
240 DCHECK(thread_checker_.CalledOnValidThread()); 240 DCHECK(thread_checker_.CalledOnValidThread());
241 FOR_EACH_OBSERVER(PushClientObserver, observers_, OnPingResponse()); 241 FOR_EACH_OBSERVER(PushClientObserver, observers_, OnPingResponse());
242 } 242 }
243 243
244 } // namespace notifier 244 } // namespace notifier
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel.cc ('k') | net/base/test_completion_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698