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

Side by Side Diff: chrome/browser/resources/gpu_internals/browser_bridge.js

Issue 10910026: Show about:sandbox status in the about:gpu page. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Show about:sandbox status in the about:gpu page. Created 8 years, 3 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 | « no previous file | chrome/browser/resources/gpu_internals/info_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) 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 cr.define('gpu', function() { 4 cr.define('gpu', function() {
5 /** 5 /**
6 * This class provides a 'bridge' for communicating between javascript and the 6 * This class provides a 'bridge' for communicating between javascript and the
7 * browser. When run outside of WebUI, e.g. as a regular webpage, it provides 7 * browser. When run outside of WebUI, e.g. as a regular webpage, it provides
8 * synthetic data to assist in testing. 8 * synthetic data to assist in testing.
9 * @constructor 9 * @constructor
10 */ 10 */
11 function BrowserBridge() { 11 function BrowserBridge() {
12 // If we are not running inside WebUI, output chrome.send messages 12 // If we are not running inside WebUI, output chrome.send messages
13 // to the console to help with quick-iteration debugging. 13 // to the console to help with quick-iteration debugging.
14 this.debugMode_ = (chrome.send === undefined && console.log); 14 this.debugMode_ = (chrome.send === undefined && console.log);
15 if (this.debugMode_) { 15 if (this.debugMode_) {
16 var browserBridgeTests = document.createElement('script'); 16 var browserBridgeTests = document.createElement('script');
17 browserBridgeTests.src = './gpu_internals/browser_bridge_tests.js'; 17 browserBridgeTests.src = './gpu_internals/browser_bridge_tests.js';
18 document.body.appendChild(browserBridgeTests); 18 document.body.appendChild(browserBridgeTests);
19 } 19 }
20 20
21 this.nextRequestId_ = 0; 21 this.nextRequestId_ = 0;
22 this.pendingCallbacks_ = []; 22 this.pendingCallbacks_ = [];
23 this.logMessages_ = []; 23 this.logMessages_ = [];
24 24
25 // Tell c++ code that we are ready to receive GPU Info. 25 // Tell c++ code that we are ready to receive GPU Info.
26 if (!this.debugMode_) { 26 if (!this.debugMode_) {
27 chrome.send('browserBridgeInitialized'); 27 chrome.send('browserBridgeInitialized');
28 this.beginRequestClientInfo_(); 28 this.beginRequestClientInfo_();
29 this.beginRequestSandboxInfo_();
29 this.beginRequestLogMessages_(); 30 this.beginRequestLogMessages_();
30 this.beginRequestCrashList_(); 31 this.beginRequestCrashList_();
31 } 32 }
32 } 33 }
33 34
34 BrowserBridge.prototype = { 35 BrowserBridge.prototype = {
35 __proto__: cr.EventTarget.prototype, 36 __proto__: cr.EventTarget.prototype,
36 37
37 applySimulatedData_: function applySimulatedData(data) { 38 applySimulatedData_: function applySimulatedData(data) {
38 // set up things according to the simulated data 39 // set up things according to the simulated data
39 this.gpuInfo_ = data.gpuInfo; 40 this.gpuInfo_ = data.gpuInfo;
40 this.clientInfo_ = data.clientInfo; 41 this.clientInfo_ = data.clientInfo;
42 this.sandboxInfo_ = data.sandboxInfo;
41 this.logMessages_ = data.logMessages; 43 this.logMessages_ = data.logMessages;
42 cr.dispatchSimpleEvent(this, 'gpuInfoUpdate'); 44 cr.dispatchSimpleEvent(this, 'gpuInfoUpdate');
43 cr.dispatchSimpleEvent(this, 'clientInfoChange'); 45 cr.dispatchSimpleEvent(this, 'clientInfoChange');
46 cr.dispatchSimpleEvent(this, 'sandboxInfoChange');
44 cr.dispatchSimpleEvent(this, 'logMessagesChange'); 47 cr.dispatchSimpleEvent(this, 'logMessagesChange');
45 }, 48 },
46 49
47 /** 50 /**
48 * Returns true if the page is hosted inside Chrome WebUI 51 * Returns true if the page is hosted inside Chrome WebUI
49 * Helps have behavior conditional to emulate_webui.py 52 * Helps have behavior conditional to emulate_webui.py
50 */ 53 */
51 get debugMode() { 54 get debugMode() {
52 return this.debugMode_; 55 return this.debugMode_;
53 }, 56 },
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 }, 114 },
112 115
113 /** 116 /**
114 * Returns information about the currently runnign Chrome build. 117 * Returns information about the currently runnign Chrome build.
115 */ 118 */
116 get clientInfo() { 119 get clientInfo() {
117 return this.clientInfo_; 120 return this.clientInfo_;
118 }, 121 },
119 122
120 /** 123 /**
124 * This function begins a request for the SandboxInfo. If it comes back
125 * as undefined, then we will issue the request again in 250ms.
126 */
127 beginRequestSandboxInfo_: function() {
128 this.callAsync('requestSandboxInfo', undefined, (function(data) {
129 if (data === undefined) { // try again in 250 ms
130 window.setTimeout(this.beginRequestSandboxInfo_.bind(this), 250);
131 } else {
132 this.sandboxInfo_ = data;
133 cr.dispatchSimpleEvent(this, 'sandboxInfoChange');
134 }
135 }).bind(this));
136 },
137
138 /**
139 * Returns information about the currently runnign Chrome sandbox.
140 */
141 get sandboxInfo() {
142 return this.sandboxInfo_;
143 },
144
145 /**
121 * This function checks for new GPU_LOG messages. 146 * This function checks for new GPU_LOG messages.
122 * If any are found, a refresh is triggered. 147 * If any are found, a refresh is triggered.
123 */ 148 */
124 beginRequestLogMessages_: function() { 149 beginRequestLogMessages_: function() {
125 this.callAsync('requestLogMessages', undefined, 150 this.callAsync('requestLogMessages', undefined,
126 (function(messages) { 151 (function(messages) {
127 if (messages.length != this.logMessages_.length) { 152 if (messages.length != this.logMessages_.length) {
128 this.logMessages_ = messages; 153 this.logMessages_ = messages;
129 cr.dispatchSimpleEvent(this, 'logMessagesChange'); 154 cr.dispatchSimpleEvent(this, 'logMessagesChange');
130 } 155 }
(...skipping 30 matching lines...) Expand all
161 get crashList() { 186 get crashList() {
162 return this.crashList_; 187 return this.crashList_;
163 } 188 }
164 189
165 }; 190 };
166 191
167 return { 192 return {
168 BrowserBridge: BrowserBridge 193 BrowserBridge: BrowserBridge
169 }; 194 };
170 }); 195 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/gpu_internals/info_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698