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

Unified Diff: device/core/scoped_device_info_list.h

Issue 1439443002: Reland: Add code to deal with serial device disconnection detection on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated BUILD.gn and gyp files Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: device/core/scoped_device_info_list.h
diff --git a/device/core/scoped_device_info_list.h b/device/core/scoped_device_info_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..5708e247b49ef8b5759f48ec55f174194dd2caaa
--- /dev/null
+++ b/device/core/scoped_device_info_list.h
@@ -0,0 +1,38 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_
+#define DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_
+
+#include <windows.h>
+#include <setupapi.h>
+
+#include "base/win/scoped_handle.h"
+
+namespace base {
+namespace win {
+
+// Traits for HDEVINFO that properly destroys it.
+struct DeviceInfoListTraits {
+ typedef HDEVINFO Handle;
+
+ static void CloseHandle(HDEVINFO handle) {
+ SetupDiDestroyDeviceInfoList(handle);
+ }
+
+ static bool IsHandleValid(HDEVINFO handle) {
+ return handle != INVALID_HANDLE_VALUE;
+ }
+
+ static HDEVINFO NullHandle() { return INVALID_HANDLE_VALUE; }
+};
+
+typedef base::win::GenericScopedHandle<DeviceInfoListTraits,
+ base::win::DummyVerifierTraits>
+ ScopedDeviceInfoList;
+
+} // namespace win
+} // namespace base
+
+#endif // DEVICE_CORE_SCOPED_DEVICE_INFO_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698