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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1389553002: bluetooth: Detect and fix incorrect thread usage of BluetoothDispatcherHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/id_map.h" 9 #include "base/id_map.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // A BluetoothAdapter instance representing an adapter of the system. 180 // A BluetoothAdapter instance representing an adapter of the system.
181 scoped_refptr<device::BluetoothAdapter> adapter_; 181 scoped_refptr<device::BluetoothAdapter> adapter_;
182 182
183 // Automatically stops Bluetooth discovery a set amount of time after it was 183 // Automatically stops Bluetooth discovery a set amount of time after it was
184 // started. We have a single timer for all of Web Bluetooth because it's 184 // started. We have a single timer for all of Web Bluetooth because it's
185 // simpler than tracking timeouts for each RequestDeviceSession individually, 185 // simpler than tracking timeouts for each RequestDeviceSession individually,
186 // and because there's no harm in extending the length of a few discovery 186 // and because there's no harm in extending the length of a few discovery
187 // sessions when other sessions are active. 187 // sessions when other sessions are active.
188 base::Timer discovery_session_timer_; 188 base::Timer discovery_session_timer_;
189 189
190 // At least one WeakPtr must always exist to enforce all factoried WeakPtr
191 // objects are bound to UI thread.
192 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_;
193
190 // Must be last member, see base/memory/weak_ptr.h documentation 194 // Must be last member, see base/memory/weak_ptr.h documentation
191 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; 195 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_;
192 196
193 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); 197 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost);
194 }; 198 };
195 199
196 } // namespace content 200 } // namespace content
197 201
198 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 202 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698