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

Side by Side Diff: chrome/browser/resources/bluetooth_internals/characteristic_list.js

Issue 2643393002: bluetooth: Remove queuing of GetCharacteristicsCallbacks (Closed)
Patch Set: Add comment explaining null/empty difference Created 3 years, 11 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 | device/bluetooth/device.h » ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 * Javascript for CharacteristicList and CharacteristicListItem, served from 6 * Javascript for CharacteristicList and CharacteristicListItem, served from
7 * chrome://bluetooth-internals/. 7 * chrome://bluetooth-internals/.
8 */ 8 */
9 9
10 cr.define('characteristic_list', function() { 10 cr.define('characteristic_list', function() {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 */ 175 */
176 load: function(deviceAddress, serviceId) { 176 load: function(deviceAddress, serviceId) {
177 if (this.characteristicsRequested_ || !this.isLoading()) 177 if (this.characteristicsRequested_ || !this.isLoading())
178 return; 178 return;
179 179
180 this.characteristicsRequested_ = true; 180 this.characteristicsRequested_ = true;
181 181
182 device_broker.connectToDevice(deviceAddress).then(function(device) { 182 device_broker.connectToDevice(deviceAddress).then(function(device) {
183 return device.getCharacteristics(serviceId); 183 return device.getCharacteristics(serviceId);
184 }.bind(this)).then(function(response) { 184 }.bind(this)).then(function(response) {
185 this.setData(new ArrayDataModel(response.characteristics)); 185 this.setData(new ArrayDataModel(response.characteristics || []));
186 this.setLoading(false); 186 this.setLoading(false);
187 this.characteristicsRequested_ = false; 187 this.characteristicsRequested_ = false;
188 }.bind(this)).catch(function(error) { 188 }.bind(this)).catch(function(error) {
189 this.characteristicsRequested_ = false; 189 this.characteristicsRequested_ = false;
190 Snackbar.show( 190 Snackbar.show(
191 deviceAddress + ': ' + error.message, SnackbarType.ERROR, 'Retry', 191 deviceAddress + ': ' + error.message, SnackbarType.ERROR, 'Retry',
192 function() { 192 function() {
193 this.load(deviceAddress, serviceId); 193 this.load(deviceAddress, serviceId);
194 }.bind(this)); 194 }.bind(this));
195 }.bind(this)); 195 }.bind(this));
196 }, 196 },
197 }; 197 };
198 198
199 return { 199 return {
200 CharacteristicList: CharacteristicList, 200 CharacteristicList: CharacteristicList,
201 CharacteristicListItem: CharacteristicListItem, 201 CharacteristicListItem: CharacteristicListItem,
202 }; 202 };
203 }); 203 });
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698