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

Side by Side Diff: chrome/browser/resources/google_now/utility.js

Issue 19749007: Processing timefences from the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing manifest typo Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 'use strict'; 5 'use strict';
6 6
7 // TODO(vadimt): Remove alerts. 7 // TODO(vadimt): Remove alerts.
8 8
9 /** 9 /**
10 * @fileoverview Utility objects and functions for Google Now extension. 10 * @fileoverview Utility objects and functions for Google Now extension.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 * Builds an object to manage retrying activities with exponential backoff. 265 * Builds an object to manage retrying activities with exponential backoff.
266 * @param {string} name Name of this attempt manager. 266 * @param {string} name Name of this attempt manager.
267 * @param {function()} attempt Activity that the manager retries until it 267 * @param {function()} attempt Activity that the manager retries until it
268 * calls 'stop' method. 268 * calls 'stop' method.
269 * @param {number} initialDelaySeconds Default first delay until first retry. 269 * @param {number} initialDelaySeconds Default first delay until first retry.
270 * @param {number} maximumDelaySeconds Maximum delay between retries. 270 * @param {number} maximumDelaySeconds Maximum delay between retries.
271 * @return {Object} Attempt manager interface. 271 * @return {Object} Attempt manager interface.
272 */ 272 */
273 function buildAttemptManager( 273 function buildAttemptManager(
274 name, attempt, initialDelaySeconds, maximumDelaySeconds) { 274 name, attempt, initialDelaySeconds, maximumDelaySeconds) {
275 var alarmName = name + '-scheduler'; 275 var alarmName = 'attempt-scheduler-' + name;
276 var currentDelayStorageKey = name + '-current-delay'; 276 var currentDelayStorageKey = 'current-delay-' + name;
277 277
278 /** 278 /**
279 * Creates an alarm for the next attempt. The alarm is repeating for the case 279 * Creates an alarm for the next attempt. The alarm is repeating for the case
280 * when the next attempt crashes before registering next alarm. 280 * when the next attempt crashes before registering next alarm.
281 * @param {number} delaySeconds Delay until next retry. 281 * @param {number} delaySeconds Delay until next retry.
282 */ 282 */
283 function createAlarm(delaySeconds) { 283 function createAlarm(delaySeconds) {
284 var alarmInfo = { 284 var alarmInfo = {
285 delayInMinutes: delaySeconds / 60, 285 delayInMinutes: delaySeconds / 60,
286 periodInMinutes: maximumDelaySeconds / 60 286 periodInMinutes: maximumDelaySeconds / 60
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (alarm.name == alarmName) 348 if (alarm.name == alarmName)
349 attempt(); 349 attempt();
350 }); 350 });
351 351
352 return { 352 return {
353 start: start, 353 start: start,
354 planForNext: planForNext, 354 planForNext: planForNext,
355 stop: stop 355 stop: stop
356 }; 356 };
357 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698