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

Side by Side Diff: content/browser/resources/gpu/browser_bridge.js

Issue 1375663002: Show GpuMemoryBuffer feature in chrome://gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use IsNativeGpuMemoryBufferConfiguration Created 5 years, 1 month 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
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 */
(...skipping 18 matching lines...) Expand all
29 this.beginRequestLogMessages_(); 29 this.beginRequestLogMessages_();
30 } 30 }
31 } 31 }
32 32
33 BrowserBridge.prototype = { 33 BrowserBridge.prototype = {
34 __proto__: cr.EventTarget.prototype, 34 __proto__: cr.EventTarget.prototype,
35 35
36 applySimulatedData_: function applySimulatedData(data) { 36 applySimulatedData_: function applySimulatedData(data) {
37 // set up things according to the simulated data 37 // set up things according to the simulated data
38 this.gpuInfo_ = data.gpuInfo; 38 this.gpuInfo_ = data.gpuInfo;
39 this.gmbInfo_ = data.gmbInfo;
39 this.clientInfo_ = data.clientInfo; 40 this.clientInfo_ = data.clientInfo;
40 this.logMessages_ = data.logMessages; 41 this.logMessages_ = data.logMessages;
41 cr.dispatchSimpleEvent(this, 'gpuInfoUpdate'); 42 cr.dispatchSimpleEvent(this, 'gpuInfoUpdate');
43 cr.dispatchSimpleEvent(this, 'gmbInfoUpdate');
reveman 2015/10/27 23:20:36 gmb -> gpu_memory_buffer
42 cr.dispatchSimpleEvent(this, 'clientInfoChange'); 44 cr.dispatchSimpleEvent(this, 'clientInfoChange');
43 cr.dispatchSimpleEvent(this, 'logMessagesChange'); 45 cr.dispatchSimpleEvent(this, 'logMessagesChange');
44 }, 46 },
45 47
46 /** 48 /**
47 * Returns true if the page is hosted inside Chrome WebUI 49 * Returns true if the page is hosted inside Chrome WebUI
48 * Helps have behavior conditional to emulate_webui.py 50 * Helps have behavior conditional to emulate_webui.py
49 */ 51 */
50 get debugMode() { 52 get debugMode() {
51 return this.debugMode_; 53 return this.debugMode_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 90
89 /** 91 /**
90 * Called from gpu c++ code when GPU Info is updated. 92 * Called from gpu c++ code when GPU Info is updated.
91 */ 93 */
92 onGpuInfoUpdate: function(gpuInfo) { 94 onGpuInfoUpdate: function(gpuInfo) {
93 this.gpuInfo_ = gpuInfo; 95 this.gpuInfo_ = gpuInfo;
94 cr.dispatchSimpleEvent(this, 'gpuInfoUpdate'); 96 cr.dispatchSimpleEvent(this, 'gpuInfoUpdate');
95 }, 97 },
96 98
97 /** 99 /**
100 * Get gmbInfo data.
101 */
102 get gmbInfo() {
103 return this.gmbInfo_;
104 },
105
106 /**
107 * Called from gpu c++ code when GpuMemoryBuffer Info is updated.
108 */
109 onGmbInfoUpdate: function(gmbInfo) {
110 this.gmbInfo_ = gmbInfo;
111 cr.dispatchSimpleEvent(this, 'gmbInfoUpdate');
112 },
113
114 /**
98 * This function begins a request for the ClientInfo. If it comes back 115 * This function begins a request for the ClientInfo. If it comes back
99 * as undefined, then we will issue the request again in 250ms. 116 * as undefined, then we will issue the request again in 250ms.
100 */ 117 */
101 beginRequestClientInfo_: function() { 118 beginRequestClientInfo_: function() {
102 this.callAsync('requestClientInfo', undefined, (function(data) { 119 this.callAsync('requestClientInfo', undefined, (function(data) {
103 if (data === undefined) { // try again in 250 ms 120 if (data === undefined) { // try again in 250 ms
104 window.setTimeout(this.beginRequestClientInfo_.bind(this), 250); 121 window.setTimeout(this.beginRequestClientInfo_.bind(this), 250);
105 } else { 122 } else {
106 this.clientInfo_ = data; 123 this.clientInfo_ = data;
107 cr.dispatchSimpleEvent(this, 'clientInfoChange'); 124 cr.dispatchSimpleEvent(this, 'clientInfoChange');
(...skipping 30 matching lines...) Expand all
138 get logMessages() { 155 get logMessages() {
139 return this.logMessages_; 156 return this.logMessages_;
140 }, 157 },
141 158
142 }; 159 };
143 160
144 return { 161 return {
145 BrowserBridge: BrowserBridge 162 BrowserBridge: BrowserBridge
146 }; 163 };
147 }); 164 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698