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

Side by Side Diff: netlog_viewer/sockets_view.js

Issue 2178423002: Bring the gh-pages branch up to date with the master branch (Closed) Base URL: https://github.com/catapult-project/catapult.git@gh-pages
Patch Set: Created 4 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
« no previous file with comments | « netlog_viewer/sockets_view.html ('k') | netlog_viewer/spdy_view.html » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * This view displays information on the state of all socket pools. 6 * This view displays information on the state of all socket pools.
7 * 7 *
8 * - Shows a summary of the state of each socket pool at the top. 8 * - Shows a summary of the state of each socket pool at the top.
9 * - For each pool with allocated sockets or connect jobs, shows all its 9 * - For each pool with allocated sockets or connect jobs, shows all its
10 * groups with any allocated sockets. 10 * groups with any allocated sockets.
11 */ 11 */
12 var SocketsView = (function() { 12 var SocketsView = (function() {
13 'use strict'; 13 'use strict';
14 14
15 // We inherit from DivView. 15 // We inherit from DivView.
16 var superClass = DivView; 16 var superClass = DivView;
17 17
18 /** 18 /**
19 * @constructor 19 * @constructor
20 */ 20 */
21 function SocketsView() { 21 function SocketsView() {
22 assertFirstConstructorCall(SocketsView); 22 assertFirstConstructorCall(SocketsView);
23 23
24 // Call superclass's constructor. 24 // Call superclass's constructor.
25 superClass.call(this, SocketsView.MAIN_BOX_ID); 25 superClass.call(this, SocketsView.MAIN_BOX_ID);
26 26
27 g_browser.addSocketPoolInfoObserver(this, true); 27 g_browser.addSocketPoolInfoObserver(this, true);
28 this.socketPoolDiv_ = $(SocketsView.SOCKET_POOL_DIV_ID); 28 this.socketPoolDiv_ = $(SocketsView.SOCKET_POOL_DIV_ID);
29 this.socketPoolGroupsDiv_ = $(SocketsView.SOCKET_POOL_GROUPS_DIV_ID); 29 this.socketPoolGroupsDiv_ = $(SocketsView.SOCKET_POOL_GROUPS_DIV_ID);
30
31 var closeIdleButton = $(SocketsView.CLOSE_IDLE_SOCKETS_BUTTON_ID);
32 closeIdleButton.onclick = this.closeIdleSockets.bind(this);
33
34 var flushSocketsButton = $(SocketsView.SOCKET_POOL_FLUSH_BUTTON_ID);
35 flushSocketsButton.onclick = this.flushSocketPools.bind(this);
36 } 30 }
37 31
38 SocketsView.TAB_ID = 'tab-handle-sockets'; 32 SocketsView.TAB_ID = 'tab-handle-sockets';
39 SocketsView.TAB_NAME = 'Sockets'; 33 SocketsView.TAB_NAME = 'Sockets';
40 SocketsView.TAB_HASH = '#sockets'; 34 SocketsView.TAB_HASH = '#sockets';
41 35
42 // IDs for special HTML elements in sockets_view.html 36 // IDs for special HTML elements in sockets_view.html
43 SocketsView.MAIN_BOX_ID = 'sockets-view-tab-content'; 37 SocketsView.MAIN_BOX_ID = 'sockets-view-tab-content';
44 SocketsView.SOCKET_POOL_DIV_ID = 'sockets-view-pool-div'; 38 SocketsView.SOCKET_POOL_DIV_ID = 'sockets-view-pool-div';
45 SocketsView.SOCKET_POOL_GROUPS_DIV_ID = 'sockets-view-pool-groups-div'; 39 SocketsView.SOCKET_POOL_GROUPS_DIV_ID = 'sockets-view-pool-groups-div';
46 SocketsView.CLOSE_IDLE_SOCKETS_BUTTON_ID = 'sockets-view-close-idle-button';
47 SocketsView.SOCKET_POOL_FLUSH_BUTTON_ID = 'sockets-view-flush-button';
48 40
49 cr.addSingletonGetter(SocketsView); 41 cr.addSingletonGetter(SocketsView);
50 42
51 SocketsView.prototype = { 43 SocketsView.prototype = {
52 // Inherit the superclass's methods. 44 // Inherit the superclass's methods.
53 __proto__: superClass.prototype, 45 __proto__: superClass.prototype,
54 46
55 onLoadLogFinish: function(data) { 47 onLoadLogFinish: function(data) {
56 return this.onSocketPoolInfoChanged(data.socketPoolInfo); 48 return this.onSocketPoolInfoChanged(data.socketPoolInfo);
57 }, 49 },
(...skipping 12 matching lines...) Expand all
70 // Add table for each socket pool with information on each of its groups. 62 // Add table for each socket pool with information on each of its groups.
71 for (var i = 0; i < socketPools.length; ++i) { 63 for (var i = 0; i < socketPools.length; ++i) {
72 if (socketPools[i].origPool.groups != undefined) { 64 if (socketPools[i].origPool.groups != undefined) {
73 var p = addNode(this.socketPoolGroupsDiv_, 'p'); 65 var p = addNode(this.socketPoolGroupsDiv_, 'p');
74 var br = addNode(p, 'br'); 66 var br = addNode(p, 'br');
75 var groupTablePrinter = socketPools[i].createGroupTablePrinter(); 67 var groupTablePrinter = socketPools[i].createGroupTablePrinter();
76 groupTablePrinter.toHTML(p, 'styled-table'); 68 groupTablePrinter.toHTML(p, 'styled-table');
77 } 69 }
78 } 70 }
79 return true; 71 return true;
80 },
81
82 closeIdleSockets: function() {
83 g_browser.sendCloseIdleSockets();
84 g_browser.checkForUpdatedInfo(false);
85 },
86
87 flushSocketPools: function() {
88 g_browser.sendFlushSocketPools();
89 g_browser.checkForUpdatedInfo(false);
90 } 72 }
91 }; 73 };
92 74
93 return SocketsView; 75 return SocketsView;
94 })(); 76 })();
95 77
OLDNEW
« no previous file with comments | « netlog_viewer/sockets_view.html ('k') | netlog_viewer/spdy_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698