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

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

Issue 1547233002: Convert Pass()→std::move() in //google_apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « google_apis/gcm/engine/gcm_store_impl_unittest.cc ('k') | google_apis/gcm/engine/mcs_client.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 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>
8
7 #include "base/callback.h" 9 #include "base/callback.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
10 #include "base/power_monitor/power_monitor.h" 12 #include "base/power_monitor/power_monitor.h"
11 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
12 #include "base/time/time.h" 14 #include "base/time/time.h"
13 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
14 #include "build/build_config.h" 16 #include "build/build_config.h"
15 #include "google_apis/gcm/protocol/mcs.pb.h" 17 #include "google_apis/gcm/protocol/mcs.pb.h"
16 #include "net/base/network_change_notifier.h" 18 #include "net/base/network_change_notifier.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return base::TimeTicks(); 115 return base::TimeTicks();
114 } 116 }
115 117
116 void HeartbeatManager::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) { 118 void HeartbeatManager::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) {
117 bool was_running = heartbeat_timer_->IsRunning(); 119 bool was_running = heartbeat_timer_->IsRunning();
118 base::TimeDelta remaining_delay = 120 base::TimeDelta remaining_delay =
119 heartbeat_timer_->desired_run_time() - base::TimeTicks::Now(); 121 heartbeat_timer_->desired_run_time() - base::TimeTicks::Now();
120 base::Closure timer_task(heartbeat_timer_->user_task()); 122 base::Closure timer_task(heartbeat_timer_->user_task());
121 123
122 heartbeat_timer_->Stop(); 124 heartbeat_timer_->Stop();
123 heartbeat_timer_ = timer.Pass(); 125 heartbeat_timer_ = std::move(timer);
124 126
125 if (was_running) 127 if (was_running)
126 heartbeat_timer_->Start(FROM_HERE, remaining_delay, timer_task); 128 heartbeat_timer_->Start(FROM_HERE, remaining_delay, timer_task);
127 } 129 }
128 130
129 void HeartbeatManager::OnSuspend() { 131 void HeartbeatManager::OnSuspend() {
130 // The system is going to sleep. Record the time, so on resume we know how 132 // The system is going to sleep. Record the time, so on resume we know how
131 // much time the machine was suspended. 133 // much time the machine was suspended.
132 suspend_time_ = base::Time::Now(); 134 suspend_time_ = base::Time::Now();
133 } 135 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 interval <= max_heartbeat_interval; 286 interval <= max_heartbeat_interval;
285 } 287 }
286 288
287 void HeartbeatManager::ResetConnection( 289 void HeartbeatManager::ResetConnection(
288 ConnectionFactory::ConnectionResetReason reason) { 290 ConnectionFactory::ConnectionResetReason reason) {
289 Stop(); 291 Stop();
290 trigger_reconnect_callback_.Run(reason); 292 trigger_reconnect_callback_.Run(reason);
291 } 293 }
292 294
293 } // namespace gcm 295 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/gcm_store_impl_unittest.cc ('k') | google_apis/gcm/engine/mcs_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698