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

Side by Side Diff: components/gcm_driver/gcm_channel_status_request.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
OLDNEW
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/gcm_driver/gcm_channel_status_request.h" 5 #include "components/gcm_driver/gcm_channel_status_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
9 #include "components/gcm_driver/gcm_backoff_policy.h" 11 #include "components/gcm_driver/gcm_backoff_policy.h"
10 #include "net/base/escape.h" 12 #include "net/base/escape.h"
11 #include "net/base/load_flags.h" 13 #include "net/base/load_flags.h"
12 #include "net/http/http_status_code.h" 14 #include "net/http/http_status_code.h"
13 #include "net/url_request/url_fetcher.h" 15 #include "net/url_request/url_fetcher.h"
14 #include "net/url_request/url_request_status.h" 16 #include "net/url_request/url_request_status.h"
15 #include "sync/protocol/experiment_status.pb.h" 17 #include "sync/protocol/experiment_status.pb.h"
16 #include "url/gurl.h" 18 #include "url/gurl.h"
17 19
18 namespace gcm { 20 namespace gcm {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void GCMChannelStatusRequest::RetryWithBackoff(bool update_backoff) { 137 void GCMChannelStatusRequest::RetryWithBackoff(bool update_backoff) {
136 if (update_backoff) { 138 if (update_backoff) {
137 url_fetcher_.reset(); 139 url_fetcher_.reset();
138 backoff_entry_.InformOfRequest(false); 140 backoff_entry_.InformOfRequest(false);
139 } 141 }
140 142
141 if (backoff_entry_.ShouldRejectRequest()) { 143 if (backoff_entry_.ShouldRejectRequest()) {
142 DVLOG(1) << "Delaying GCM channel request for " 144 DVLOG(1) << "Delaying GCM channel request for "
143 << backoff_entry_.GetTimeUntilRelease().InMilliseconds() 145 << backoff_entry_.GetTimeUntilRelease().InMilliseconds()
144 << " ms."; 146 << " ms.";
145 base::MessageLoop::current()->PostDelayedTask( 147 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
146 FROM_HERE, 148 FROM_HERE, base::Bind(&GCMChannelStatusRequest::RetryWithBackoff,
147 base::Bind(&GCMChannelStatusRequest::RetryWithBackoff, 149 weak_ptr_factory_.GetWeakPtr(), false),
148 weak_ptr_factory_.GetWeakPtr(),
149 false),
150 backoff_entry_.GetTimeUntilRelease()); 150 backoff_entry_.GetTimeUntilRelease());
151 return; 151 return;
152 } 152 }
153 153
154 Start(); 154 Start();
155 } 155 }
156 156
157 } // namespace gcm 157 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/fake_gcm_client.cc ('k') | components/gcm_driver/gcm_channel_status_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698