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

Side by Side Diff: content/renderer/bluetooth/bluetooth_dispatcher.cc

Issue 1746973002: bluetooth: Fix leak in getCharacteristics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/renderer/bluetooth/bluetooth_dispatcher.h" 5 #include "content/renderer/bluetooth/bluetooth_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 for (size_t i = 0; i < characteristics_instance_ids.size(); i++) { 722 for (size_t i = 0; i < characteristics_instance_ids.size(); i++) {
723 (*characteristics)[i] = new WebBluetoothRemoteGATTCharacteristicInit( 723 (*characteristics)[i] = new WebBluetoothRemoteGATTCharacteristicInit(
724 request->service_instance_id, 724 request->service_instance_id,
725 WebString::fromUTF8(characteristics_instance_ids[i]), 725 WebString::fromUTF8(characteristics_instance_ids[i]),
726 WebString::fromUTF8(characteristics_uuids[i]), 726 WebString::fromUTF8(characteristics_uuids[i]),
727 characteristics_properties[i]); 727 characteristics_properties[i]);
728 } 728 }
729 729
730 request->callbacks->onSuccess(blink::adoptWebPtr(characteristics)); 730 request->callbacks->onSuccess(blink::adoptWebPtr(characteristics));
731 731
732 pending_characteristics_requests_.Lookup(request_id); 732 pending_characteristics_requests_.Remove(request_id);
733 } 733 }
734 734
735 void BluetoothDispatcher::OnGetCharacteristicsError(int thread_id, 735 void BluetoothDispatcher::OnGetCharacteristicsError(int thread_id,
736 int request_id, 736 int request_id,
737 WebBluetoothError error) { 737 WebBluetoothError error) {
738 DCHECK(pending_characteristics_requests_.Lookup(request_id)) << request_id; 738 DCHECK(pending_characteristics_requests_.Lookup(request_id)) << request_id;
739 739
740 pending_characteristics_requests_.Lookup(request_id) 740 pending_characteristics_requests_.Lookup(request_id)
741 ->callbacks->onError(WebBluetoothError(error)); 741 ->callbacks->onError(WebBluetoothError(error));
742 742
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 int thread_id, 870 int thread_id,
871 const std::string& characteristic_instance_id, 871 const std::string& characteristic_instance_id,
872 const std::vector<uint8_t> new_value) { 872 const std::vector<uint8_t> new_value) {
873 auto active_iter = active_characteristics_.find(characteristic_instance_id); 873 auto active_iter = active_characteristics_.find(characteristic_instance_id);
874 if (active_iter != active_characteristics_.end()) { 874 if (active_iter != active_characteristics_.end()) {
875 active_iter->second->dispatchCharacteristicValueChanged(new_value); 875 active_iter->second->dispatchCharacteristicValueChanged(new_value);
876 } 876 }
877 } 877 }
878 878
879 } // namespace content 879 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698