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

Unified Diff: content/browser/background_sync/background_sync_manager.cc

Issue 1525743002: Allow ServiceWorker events to have custom durations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use std::move instead of .Pass Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_version.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..877b518692099f2b547167140ad9905c45515ea3 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 = 3 * 60; // 3 minutes
+
void PostErrorResponse(
BackgroundSyncStatus status,
const BackgroundSyncManager::StatusAndRegistrationCallback& callback) {
@@ -775,7 +778,9 @@ void BackgroundSyncManager::FireOneShotSync(
// 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,
+ base::TimeDelta::FromSeconds(kSyncEventSec),
+ callback);
}
void BackgroundSyncManager::ScheduleDelayedTask(const base::Closure& callback,
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698