Link GCM heartbeat with wake on wifi preference
Currently, the GCM heartbeat manager schedules a timer that will always
wake up the system from suspend in order to send a heartbeat message.
This is bad for battery life if the user doesn't actually want to use
the wake on packet feature. To deal with this problem:
- Add a new function, SetWakeFromSuspend, to the AlarmTimer class so
that its wake from suspend ability can be changed on the fly.
- Drill a hole through GCM's beautiful abstraction layers so that we can
get to the HeartbeatManager via the GCMDriver interface.
- Hook up the endpoint in the GCMDriver interface to
WakeOnWifiManager::OnPreferenceChanged so that the wake from suspend
property for all the GCM heartbeat timers is changed along with
shill's settings.
BUG=397328, chrome-os-partner:34142
Review URL: https://codereview.chromium.org/745123002
Cr-Commit-Position: refs/heads/master@{#307151}
diff --git a/components/gcm_driver/fake_gcm_client.cc b/components/gcm_driver/fake_gcm_client.cc
index fdf636f..ea45c233 100644
--- a/components/gcm_driver/fake_gcm_client.cc
+++ b/components/gcm_driver/fake_gcm_client.cc
@@ -11,6 +11,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/sys_byteorder.h"
#include "base/time/time.h"
+#include "base/timer/timer.h"
#include "google_apis/gcm/base/encryptor.h"
#include "google_apis/gcm/engine/account_mapping.h"
#include "net/base/ip_endpoint.h"
@@ -133,6 +134,9 @@
void FakeGCMClient::SetLastTokenFetchTime(const base::Time& time) {
}
+void FakeGCMClient::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) {
+}
+
void FakeGCMClient::PerformDelayedLoading() {
DCHECK(ui_thread_->RunsTasksOnCurrentThread());