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

Side by Side Diff: remoting/webapp/me2mom/server_log_entry.js

Issue 8893015: The chromoting client logs a session ID to the server, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow for session ID expiry. Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/me2mom/log_to_server.js ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * A class of server log entries. 7 * A class of server log entries.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** 15 /**
16 * @private 16 * @private
17 * @constructor 17 * @constructor
18 */ 18 */
19 remoting.ServerLogEntry = function() { 19 remoting.ServerLogEntry = function() {
20 /** @type Object.<string, string> */ this.dict = {}; 20 /** @type Object.<string, string> */ this.dict = {};
21 }; 21 };
22 22
23 /** @private */ 23 /** @private */
24 remoting.ServerLogEntry.KEY_EVENT_NAME_ = 'event-name'; 24 remoting.ServerLogEntry.KEY_EVENT_NAME_ = 'event-name';
25 /** @private */ 25 /** @private */
26 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_ = 26 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_ =
27 'session-state'; 27 'session-state';
28 28
29 /** @private */ 29 /** @private */
30 remoting.ServerLogEntry.KEY_ID_ = 'id'; 30 remoting.ServerLogEntry.KEY_SESSION_ID_ = 'session-id';
31 31
32 /** @private */ 32 /** @private */
33 remoting.ServerLogEntry.KEY_ROLE_ = 'role'; 33 remoting.ServerLogEntry.KEY_ROLE_ = 'role';
34 /** @private */ 34 /** @private */
35 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_ = 'client'; 35 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_ = 'client';
36 36
37 /** @private */ 37 /** @private */
38 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; 38 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state';
39 39
40 /** 40 /**
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 /** @private */ 126 /** @private */
127 remoting.ServerLogEntry.KEY_CPU_ = 'cpu'; 127 remoting.ServerLogEntry.KEY_CPU_ = 'cpu';
128 128
129 /** @private */ 129 /** @private */
130 remoting.ServerLogEntry.KEY_BROWSER_VERSION_ = 'browser-version'; 130 remoting.ServerLogEntry.KEY_BROWSER_VERSION_ = 'browser-version';
131 131
132 /** @private */ 132 /** @private */
133 remoting.ServerLogEntry.KEY_WEBAPP_VERSION_ = 'webapp-version'; 133 remoting.ServerLogEntry.KEY_WEBAPP_VERSION_ = 'webapp-version';
134 134
135 /** @private */
136 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_OLD_ = 'session-id-old';
137
138 /** @private */
139 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_NEW_ = 'session-id-new';
140
135 /** 141 /**
136 * Sets one field in this log entry. 142 * Sets one field in this log entry.
137 * 143 *
138 * @private 144 * @private
139 * @param {string} key 145 * @param {string} key
140 * @param {string} value 146 * @param {string} value
141 */ 147 */
142 remoting.ServerLogEntry.prototype.set = function(key, value) { 148 remoting.ServerLogEntry.prototype.set = function(key, value) {
143 this.dict[key] = value; 149 this.dict[key] = value;
144 }; 150 };
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 * @return {boolean} whether the statistic is non-zero 248 * @return {boolean} whether the statistic is non-zero
243 */ 249 */
244 remoting.ServerLogEntry.prototype.addStatsField = function( 250 remoting.ServerLogEntry.prototype.addStatsField = function(
245 entryKey, statsKey, statsAccumulator) { 251 entryKey, statsKey, statsAccumulator) {
246 var val = statsAccumulator.calcMean(statsKey); 252 var val = statsAccumulator.calcMean(statsKey);
247 this.set(entryKey, val.toString()); 253 this.set(entryKey, val.toString());
248 return (val != 0); 254 return (val != 0);
249 }; 255 };
250 256
251 /** 257 /**
252 * Adds an ID field to this log entry. 258 * Makes a log entry for a "this session ID is old" event.
253 * 259 *
254 * @param {string} id 260 * @param {string} sessionId
261 * @return {remoting.ServerLogEntry}
255 */ 262 */
256 remoting.ServerLogEntry.prototype.addIdField = function(id) { 263 remoting.ServerLogEntry.makeSessionIdOld = function(sessionId) {
257 this.set(remoting.ServerLogEntry.KEY_ID_, id); 264 var entry = new remoting.ServerLogEntry();
265 entry.set(remoting.ServerLogEntry.KEY_ROLE_,
266 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_);
267 entry.set(remoting.ServerLogEntry.KEY_EVENT_NAME_,
268 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_OLD_);
269 entry.addSessionIdField(sessionId);
270 return entry;
271 };
272
273 /**
274 * Makes a log entry for a "this session ID is new" event.
275 *
276 * @param {string} sessionId
277 * @return {remoting.ServerLogEntry}
278 */
279 remoting.ServerLogEntry.makeSessionIdNew = function(sessionId) {
280 var entry = new remoting.ServerLogEntry();
281 entry.set(remoting.ServerLogEntry.KEY_ROLE_,
282 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_);
283 entry.set(remoting.ServerLogEntry.KEY_EVENT_NAME_,
284 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_NEW_);
285 entry.addSessionIdField(sessionId);
286 return entry;
287 };
288
289 /**
290 * Adds a session ID field to this log entry.
291 *
292 * @param {string} sessionId
293 */
294 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) {
295 this.set(remoting.ServerLogEntry.KEY_SESSION_ID_, sessionId);
258 } 296 }
259 297
260 /** 298 /**
261 * Adds fields describing the host to this log entry. 299 * Adds fields describing the host to this log entry.
262 */ 300 */
263 remoting.ServerLogEntry.prototype.addHostFields = function() { 301 remoting.ServerLogEntry.prototype.addHostFields = function() {
264 var host = remoting.ServerLogEntry.getHostData(); 302 var host = remoting.ServerLogEntry.getHostData();
265 if (host) { 303 if (host) {
266 if (host.os_name.length > 0) { 304 if (host.os_name.length > 0) {
267 this.set(remoting.ServerLogEntry.KEY_OS_NAME_, host.os_name); 305 this.set(remoting.ServerLogEntry.KEY_OS_NAME_, host.os_name);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 return null; 410 return null;
373 }; 411 };
374 412
375 /** 413 /**
376 * Adds a field specifying the webapp version to this log entry. 414 * Adds a field specifying the webapp version to this log entry.
377 */ 415 */
378 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { 416 remoting.ServerLogEntry.prototype.addWebappVersionField = function() {
379 this.set(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_, 417 this.set(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_,
380 chrome.app.getDetails().version); 418 chrome.app.getDetails().version);
381 }; 419 };
OLDNEW
« no previous file with comments | « remoting/webapp/me2mom/log_to_server.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698