Index: content/browser/background_sync/background_sync_manager.cc |
diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc |
index f937535f7020539a8b0c97cc411f5707fe740b0a..e9c29b01ac959fd855209737fc7343f81a388366 100644 |
--- a/content/browser/background_sync/background_sync_manager.cc |
+++ b/content/browser/background_sync/background_sync_manager.cc |
@@ -47,6 +47,9 @@ namespace { |
// The key used to index the background sync data in ServiceWorkerStorage. |
const char kBackgroundSyncUserDataKey[] = "BackgroundSyncUserData"; |
+// The amount of time that a sync event can fire for, in seconds. |
+const int kSyncEventSec = 5 * 60; // 5 minutes |
+ |
void PostErrorResponse( |
BackgroundSyncStatus status, |
const BackgroundSyncManager::StatusAndRegistrationCallback& callback) { |
@@ -771,11 +774,15 @@ void BackgroundSyncManager::FireOneShotSync( |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
DCHECK(active_version); |
+ base::TimeTicks expiration = |
+ base::TimeTicks::Now() + base::TimeDelta::FromSeconds(kSyncEventSec); |
+ |
// The ServiceWorkerVersion doesn't know when the client (javascript) is done |
// with the registration so don't give it a BackgroundSyncRegistrationHandle. |
// Once the render process gets the handle_id it can create its own handle |
// (with a new unique handle id). |
- active_version->DispatchSyncEvent(handle_id, last_chance, callback); |
+ active_version->DispatchSyncEvent(handle_id, last_chance, expiration, |
+ callback); |
} |
void BackgroundSyncManager::ScheduleDelayedTask(const base::Closure& callback, |