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

Unified Diff: mojo/common/common_custom_types_struct_traits_win.h

Issue 2561003002: Add mojo structs for ScopedFD and ScopedHandle. (Closed)
Patch Set: Created 4 years 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: mojo/common/common_custom_types_struct_traits_win.h
diff --git a/mojo/common/common_custom_types_struct_traits_win.h b/mojo/common/common_custom_types_struct_traits_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..317bfda1cf36af13079ce1c0286f797a9fe170dd
--- /dev/null
+++ b/mojo/common/common_custom_types_struct_traits_win.h
@@ -0,0 +1,32 @@
+// Copyright 2016 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 MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_WIN_H_
+#define MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_WIN_H_
+
+#include "base/win/scoped_handle.h"
+#include "mojo/common/mojo_common_export.h"
+#include "mojo/common/platform_handle.mojom-shared.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<common::mojom::WindowsHandleDataView,
+ base::win::ScopedHandle> {
+ static bool IsNull(const base::win::ScopedHandle& handle) {
+ return !handle.IsValid();
+ }
+
+ static void SetToNull(base::win::ScopedHandle* handle) {
+ *handle = base::win::ScopedHandle();
+ }
+
+ static mojo::ScopedHandle wrapped_handle(base::win::ScopedHandle& handle);
+ static bool Read(common::mojom::WindowsHandleDataView data,
+ base::win::ScopedHandle* handle);
+};
+
+} // namespace mojo
+
+#endif // MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_WIN_H_
« no previous file with comments | « mojo/common/common_custom_types_struct_traits_posix.cc ('k') | mojo/common/common_custom_types_struct_traits_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698