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

Side by Side Diff: google_apis/gcm/engine/heartbeat_manager.cc

Issue 1873663002: Convert //google_apis from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "google_apis/gcm/engine/heartbeat_manager.h" 5 #include "google_apis/gcm/engine/heartbeat_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 UpdateHeartbeatInterval(); 115 UpdateHeartbeatInterval();
116 } 116 }
117 117
118 base::TimeTicks HeartbeatManager::GetNextHeartbeatTime() const { 118 base::TimeTicks HeartbeatManager::GetNextHeartbeatTime() const {
119 if (heartbeat_timer_->IsRunning()) 119 if (heartbeat_timer_->IsRunning())
120 return heartbeat_timer_->desired_run_time(); 120 return heartbeat_timer_->desired_run_time();
121 else 121 else
122 return base::TimeTicks(); 122 return base::TimeTicks();
123 } 123 }
124 124
125 void HeartbeatManager::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) { 125 void HeartbeatManager::UpdateHeartbeatTimer(
126 std::unique_ptr<base::Timer> timer) {
126 bool was_running = heartbeat_timer_->IsRunning(); 127 bool was_running = heartbeat_timer_->IsRunning();
127 base::TimeDelta remaining_delay = 128 base::TimeDelta remaining_delay =
128 heartbeat_timer_->desired_run_time() - base::TimeTicks::Now(); 129 heartbeat_timer_->desired_run_time() - base::TimeTicks::Now();
129 base::Closure timer_task(heartbeat_timer_->user_task()); 130 base::Closure timer_task(heartbeat_timer_->user_task());
130 131
131 heartbeat_timer_->Stop(); 132 heartbeat_timer_->Stop();
132 heartbeat_timer_ = std::move(timer); 133 heartbeat_timer_ = std::move(timer);
133 134
134 if (was_running) 135 if (was_running)
135 heartbeat_timer_->Start(FROM_HERE, remaining_delay, timer_task); 136 heartbeat_timer_->Start(FROM_HERE, remaining_delay, timer_task);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 interval <= max_heartbeat_interval; 294 interval <= max_heartbeat_interval;
294 } 295 }
295 296
296 void HeartbeatManager::ResetConnection( 297 void HeartbeatManager::ResetConnection(
297 ConnectionFactory::ConnectionResetReason reason) { 298 ConnectionFactory::ConnectionResetReason reason) {
298 Stop(); 299 Stop();
299 trigger_reconnect_callback_.Run(reason); 300 trigger_reconnect_callback_.Run(reason);
300 } 301 }
301 302
302 } // namespace gcm 303 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698