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

Side by Side Diff: device/bluetooth/bluetooth_init_win.cc

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turned adapter_callbacks to a lazy instance. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « device/bluetooth/bluetooth_init_win.h ('k') | device/bluetooth/bluetooth_service_record_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "device/bluetooth/bluetooth_init_win.h"
6
7 #include "base/threading/thread_restrictions.h"
8
9 namespace {
10
11 // A frame-based exception handler filter function for a handler for exceptions
12 // generated by the Visual C++ delay loader helper function.
13 int FilterVisualCPPExceptions(DWORD exception_code) {
14 return HRESULT_FACILITY(exception_code) == FACILITY_VISUALCPP ?
15 EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
16 }
17
18 } // namespace
19
20 namespace device {
21 namespace bluetooth_init_win {
22
23 bool HasBluetoothStack() {
24 static enum {
25 HBS_UNKNOWN,
26 HBS_YES,
27 HBS_NO,
28 } has_bluetooth_stack = HBS_UNKNOWN;
29
30 if (has_bluetooth_stack == HBS_UNKNOWN) {
31 base::ThreadRestrictions::AssertIOAllowed();
32 HRESULT hr = E_FAIL;
33 __try {
34 hr = __HrLoadAllImportsForDll("bthprops.cpl");
35 } __except(FilterVisualCPPExceptions(::GetExceptionCode())) {
36 hr = E_FAIL;
37 }
38 has_bluetooth_stack = SUCCEEDED(hr) ? HBS_YES : HBS_NO;
39 }
40
41 return has_bluetooth_stack == HBS_YES;
42 }
43
44 } // namespace bluetooth_init_win
45 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_init_win.h ('k') | device/bluetooth/bluetooth_service_record_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698