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

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

Issue 9706037: Display crash report IDs in about:gpu (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « 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.beginRequestLogMessages_(); 29 this.beginRequestLogMessages_();
30 this.beginRequestCrashList_();
30 } 31 }
31 } 32 }
32 33
33 BrowserBridge.prototype = { 34 BrowserBridge.prototype = {
34 __proto__: cr.EventTarget.prototype, 35 __proto__: cr.EventTarget.prototype,
35 36
36 applySimulatedData_: function applySimulatedData(data) { 37 applySimulatedData_: function applySimulatedData(data) {
37 // set up things according to the simulated data 38 // set up things according to the simulated data
38 this.gpuInfo_ = data.gpuInfo; 39 this.gpuInfo_ = data.gpuInfo;
39 this.clientInfo_ = data.clientInfo; 40 this.clientInfo_ = data.clientInfo;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // check again in 250 ms 131 // check again in 250 ms
131 window.setTimeout(this.beginRequestLogMessages_.bind(this), 250); 132 window.setTimeout(this.beginRequestLogMessages_.bind(this), 250);
132 }).bind(this)); 133 }).bind(this));
133 }, 134 },
134 135
135 /** 136 /**
136 * Returns an array of log messages issued by the GPU process, if any. 137 * Returns an array of log messages issued by the GPU process, if any.
137 */ 138 */
138 get logMessages() { 139 get logMessages() {
139 return this.logMessages_; 140 return this.logMessages_;
141 },
142
143 /**
144 * This function checks for previous crash list.
145 * If it's not available yet, a refresh is triggered.
146 */
147 beginRequestCrashList_: function() {
148 this.callAsync('requestCrashList', undefined, (function(data) {
149 if (data === undefined) { // try again in 250 ms
150 window.setTimeout(this.beginRequestCrashList_.bind(this), 250);
151 } else {
152 this.crashList_ = data;
153 cr.dispatchSimpleEvent(this, 'crashListChange');
154 }
155 }).bind(this));
156 },
157
158 /**
159 * Returns an array of log messages issued by the GPU process, if any.
160 */
161 get crashList() {
162 return this.crashList_;
140 } 163 }
141 164
142 }; 165 };
143 166
144 return { 167 return {
145 BrowserBridge: BrowserBridge 168 BrowserBridge: BrowserBridge
146 }; 169 };
147 }); 170 });
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