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

Side by Side Diff: chrome/browser/resources/net_internals/socketsview.js

Issue 6840022: net-internals: Add buttons to close idle and flush all sockets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 2010 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 * 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 * @constructor 12 * @constructor
13 */ 13 */
14 function SocketsView(mainBoxId, socketPoolDivId, socketPoolGroupsDivId) { 14 function SocketsView(mainBoxId, socketPoolDivId, socketPoolGroupsDivId,
15 closeIdleSocketsButtonId, socketPoolFlushButtonId) {
15 DivView.call(this, mainBoxId); 16 DivView.call(this, mainBoxId);
16 17
17 g_browser.addSocketPoolInfoObserver(this); 18 g_browser.addSocketPoolInfoObserver(this);
18 this.socketPoolDiv_ = document.getElementById(socketPoolDivId); 19 this.socketPoolDiv_ = document.getElementById(socketPoolDivId);
19 this.socketPoolGroupsDiv_ = document.getElementById(socketPoolGroupsDivId); 20 this.socketPoolGroupsDiv_ = document.getElementById(socketPoolGroupsDivId);
21
22 var closeIdleButton = document.getElementById(closeIdleSocketsButtonId);
23 closeIdleButton.onclick = this.closeIdleSockets.bind(this);
24
25 var flushSocketsButton = document.getElementById(socketPoolFlushButtonId);
26 flushSocketsButton.onclick = this.flushSocketPools.bind(this);
20 } 27 }
21 28
22 inherits(SocketsView, DivView); 29 inherits(SocketsView, DivView);
23 30
24 SocketsView.prototype.onSocketPoolInfoChanged = function(socketPoolInfo) { 31 SocketsView.prototype.onSocketPoolInfoChanged = function(socketPoolInfo) {
25 this.socketPoolDiv_.innerHTML = ''; 32 this.socketPoolDiv_.innerHTML = '';
26 this.socketPoolGroupsDiv_.innerHTML = ''; 33 this.socketPoolGroupsDiv_.innerHTML = '';
27 34
28 if (!socketPoolInfo) 35 if (!socketPoolInfo)
29 return; 36 return;
30 37
31 var socketPools = SocketPoolWrapper.createArrayFrom(socketPoolInfo); 38 var socketPools = SocketPoolWrapper.createArrayFrom(socketPoolInfo);
32 var tablePrinter = SocketPoolWrapper.createTablePrinter(socketPools); 39 var tablePrinter = SocketPoolWrapper.createTablePrinter(socketPools);
33 tablePrinter.toHTML(this.socketPoolDiv_, 'styledTable'); 40 tablePrinter.toHTML(this.socketPoolDiv_, 'styledTable');
34 41
35 // Add table for each socket pool with information on each of its groups. 42 // Add table for each socket pool with information on each of its groups.
36 for (var i = 0; i < socketPools.length; ++i) { 43 for (var i = 0; i < socketPools.length; ++i) {
37 if (socketPools[i].origPool.groups != undefined) { 44 if (socketPools[i].origPool.groups != undefined) {
38 var p = addNode(this.socketPoolGroupsDiv_, 'p'); 45 var p = addNode(this.socketPoolGroupsDiv_, 'p');
39 var br = addNode(p, 'br'); 46 var br = addNode(p, 'br');
40 var groupTablePrinter = socketPools[i].createGroupTablePrinter(); 47 var groupTablePrinter = socketPools[i].createGroupTablePrinter();
41 groupTablePrinter.toHTML(p, 'styledTable'); 48 groupTablePrinter.toHTML(p, 'styledTable');
42 } 49 }
43 } 50 }
44 }; 51 };
52
53 SocketsView.prototype.closeIdleSockets = function() {
54 g_browser.sendCloseIdleSockets();
55 g_browser.checkForUpdatedInfo(false);
56 }
57
58 SocketsView.prototype.flushSocketPools = function() {
59 g_browser.sendFlushSocketPools();
60 g_browser.checkForUpdatedInfo(false);
61 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/main.js ('k') | chrome/browser/ui/webui/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698