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

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: arv@ notes Created 7 years, 4 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
« no previous file with comments | « chrome/browser/resources/google_now/manifest.json ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 * Builds an object to manage retrying activities with exponential backoff. 267 * Builds an object to manage retrying activities with exponential backoff.
268 * @param {string} name Name of this attempt manager. 268 * @param {string} name Name of this attempt manager.
269 * @param {function()} attempt Activity that the manager retries until it 269 * @param {function()} attempt Activity that the manager retries until it
270 * calls 'stop' method. 270 * calls 'stop' method.
271 * @param {number} initialDelaySeconds Default first delay until first retry. 271 * @param {number} initialDelaySeconds Default first delay until first retry.
272 * @param {number} maximumDelaySeconds Maximum delay between retries. 272 * @param {number} maximumDelaySeconds Maximum delay between retries.
273 * @return {Object} Attempt manager interface. 273 * @return {Object} Attempt manager interface.
274 */ 274 */
275 function buildAttemptManager( 275 function buildAttemptManager(
276 name, attempt, initialDelaySeconds, maximumDelaySeconds) { 276 name, attempt, initialDelaySeconds, maximumDelaySeconds) {
277 var alarmName = name + '-scheduler'; 277 var alarmName = 'attempt-scheduler-' + name;
278 var currentDelayStorageKey = name + '-current-delay'; 278 var currentDelayStorageKey = 'current-delay-' + name;
279 279
280 /** 280 /**
281 * Creates an alarm for the next attempt. The alarm is repeating for the case 281 * Creates an alarm for the next attempt. The alarm is repeating for the case
282 * when the next attempt crashes before registering next alarm. 282 * when the next attempt crashes before registering next alarm.
283 * @param {number} delaySeconds Delay until next retry. 283 * @param {number} delaySeconds Delay until next retry.
284 */ 284 */
285 function createAlarm(delaySeconds) { 285 function createAlarm(delaySeconds) {
286 var alarmInfo = { 286 var alarmInfo = {
287 delayInMinutes: delaySeconds / 60, 287 delayInMinutes: delaySeconds / 60,
288 periodInMinutes: maximumDelaySeconds / 60 288 periodInMinutes: maximumDelaySeconds / 60
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (alarm.name == alarmName) 350 if (alarm.name == alarmName)
351 attempt(); 351 attempt();
352 }); 352 });
353 353
354 return { 354 return {
355 start: start, 355 start: start,
356 planForNext: planForNext, 356 planForNext: planForNext,
357 stop: stop 357 stop: stop
358 }; 358 };
359 } 359 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/google_now/manifest.json ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698