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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_event_router.cc

Issue 2865383002: PostTask MaybeReleaseAdapter in BluetoothEventRouter::AdapterDiscoveringChanged (Closed)
Patch Set: Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "extensions/browser/api/bluetooth/bluetooth_event_router.h" 5 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 continue; 323 continue;
324 } 324 }
325 delete session; 325 delete session;
326 } 326 }
327 discovery_session_map_.swap(active_session_map); 327 discovery_session_map_.swap(active_session_map);
328 } 328 }
329 329
330 DispatchAdapterStateEvent(); 330 DispatchAdapterStateEvent();
331 331
332 // Release the adapter after dispatching the event. 332 // Release the adapter after dispatching the event.
333 if (!discovering) 333 if (!discovering) {
334 MaybeReleaseAdapter(); 334 base::ThreadTaskRunnerHandle::Get()->PostTask(
335 FROM_HERE, base::Bind(&BluetoothEventRouter::MaybeReleaseAdapter,
336 weak_ptr_factory_.GetWeakPtr()));
337 }
335 } 338 }
336 339
337 void BluetoothEventRouter::DeviceAdded(device::BluetoothAdapter* adapter, 340 void BluetoothEventRouter::DeviceAdded(device::BluetoothAdapter* adapter,
338 device::BluetoothDevice* device) { 341 device::BluetoothDevice* device) {
339 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 342 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
340 if (adapter != adapter_.get()) { 343 if (adapter != adapter_.get()) {
341 BLUETOOTH_LOG(DEBUG) << "Ignoring event for adapter " 344 BLUETOOTH_LOG(DEBUG) << "Ignoring event for adapter "
342 << adapter->GetAddress(); 345 << adapter->GetAddress();
343 return; 346 return;
344 } 347 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 503 }
501 504
502 void BluetoothEventRouter::OnExtensionUnloaded( 505 void BluetoothEventRouter::OnExtensionUnloaded(
503 content::BrowserContext* browser_context, 506 content::BrowserContext* browser_context,
504 const Extension* extension, 507 const Extension* extension,
505 UnloadedExtensionInfo::Reason reason) { 508 UnloadedExtensionInfo::Reason reason) {
506 CleanUpForExtension(extension->id()); 509 CleanUpForExtension(extension->id());
507 } 510 }
508 511
509 } // namespace extensions 512 } // namespace extensions
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