| Index: components/gcm_driver/gcm_driver_desktop.cc
|
| diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc
|
| index 7db396d8fdb217cab702bc887bef59eeffdf4a10..73143e6b30a1ab99285581acad554424b2c7256d 100644
|
| --- a/components/gcm_driver/gcm_driver_desktop.cc
|
| +++ b/components/gcm_driver/gcm_driver_desktop.cc
|
| @@ -87,6 +87,8 @@ class GCMDriverDesktop::IOWorker : public GCMClient::Delegate {
|
| void RemoveAccountMapping(const std::string& account_id);
|
| void SetLastTokenFetchTime(const base::Time& time);
|
| void WakeFromSuspendForHeartbeat(bool wake);
|
| + void AddHeartbeatInterval(const std::string& scope, int interval_ms);
|
| + void RemoveHeartbeatInterval(const std::string& scope);
|
|
|
| // For testing purpose. Can be called from UI thread. Use with care.
|
| GCMClient* gcm_client_for_testing() const { return gcm_client_.get(); }
|
| @@ -357,6 +359,19 @@ void GCMDriverDesktop::IOWorker::WakeFromSuspendForHeartbeat(bool wake) {
|
| #endif
|
| }
|
|
|
| +void GCMDriverDesktop::IOWorker::AddHeartbeatInterval(
|
| + const std::string& scope,
|
| + int interval_ms) {
|
| + DCHECK(io_thread_->RunsTasksOnCurrentThread());
|
| + gcm_client_->AddHeartbeatInterval(scope, interval_ms);
|
| +}
|
| +
|
| +void GCMDriverDesktop::IOWorker::RemoveHeartbeatInterval(
|
| + const std::string& scope) {
|
| + DCHECK(io_thread_->RunsTasksOnCurrentThread());
|
| + gcm_client_->RemoveHeartbeatInterval(scope);
|
| +}
|
| +
|
| GCMDriverDesktop::GCMDriverDesktop(
|
| scoped_ptr<GCMClientFactory> gcm_client_factory,
|
| const GCMClient::ChromeBuildInfo& chrome_build_info,
|
| @@ -686,6 +701,28 @@ void GCMDriverDesktop::WakeFromSuspendForHeartbeat(bool wake) {
|
| wake_from_suspend_enabled_));
|
| }
|
|
|
| +void GCMDriverDesktop::AddHeartbeatInterval(const std::string& scope,
|
| + int interval_ms) {
|
| + DCHECK(ui_thread_->RunsTasksOnCurrentThread());
|
| +
|
| + io_thread_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&GCMDriverDesktop::IOWorker::AddHeartbeatInterval,
|
| + base::Unretained(io_worker_.get()),
|
| + scope,
|
| + interval_ms));
|
| +}
|
| +
|
| +void GCMDriverDesktop::RemoveHeartbeatInterval(const std::string& scope) {
|
| + DCHECK(ui_thread_->RunsTasksOnCurrentThread());
|
| +
|
| + io_thread_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&GCMDriverDesktop::IOWorker::RemoveHeartbeatInterval,
|
| + base::Unretained(io_worker_.get()),
|
| + scope));
|
| +}
|
| +
|
| void GCMDriverDesktop::SetAccountTokens(
|
| const std::vector<GCMClient::AccountTokenInfo>& account_tokens) {
|
| DCHECK(ui_thread_->RunsTasksOnCurrentThread());
|
|
|