forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide base::ScopedMxHandle helper for use in Fuchsia implementations.
base::ScopedMxHandle uses ScopedGeneric to manage an mx_handle_t. ScopedGeneric is updated to provide a receive() API, allowing its use as a direct out-parameter, since most Magenta APIs return handles that way. Bug: 740791, 706592 Change-Id: I1491fe3a3eba354e4dd4ebf2d3feae6759e3f87b Reviewed-on: https://chromium-review.googlesource.com/602394 Commit-Queue: Wez <wez@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Albert J. Wong <ajwong@chromium.org> Cr-Commit-Position: refs/heads/master@{#493073}
- Loading branch information
Wez
authored and
Commit Bot
committed
Aug 9, 2017
1 parent
d8faf36
commit 78b7331
Showing
9 changed files
with
97 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2017 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 BASE_FUCHSIA_SCOPED_MX_HANDLE_H_ | ||
#define BASE_FUCHSIA_SCOPED_MX_HANDLE_H_ | ||
|
||
#include <magenta/status.h> | ||
#include <magenta/syscalls.h> | ||
|
||
#include "base/logging.h" | ||
#include "base/scoped_generic.h" | ||
|
||
namespace base { | ||
|
||
namespace internal { | ||
|
||
struct ScopedMxHandleTraits { | ||
static mx_handle_t InvalidValue() { return MX_HANDLE_INVALID; } | ||
static void Free(mx_handle_t object) { | ||
mx_status_t status = mx_handle_close(object); | ||
CHECK_EQ(MX_OK, status) << mx_status_get_string(status); | ||
} | ||
}; | ||
|
||
} // namespace internal | ||
|
||
using ScopedMxHandle = | ||
ScopedGeneric<mx_handle_t, internal::ScopedMxHandleTraits>; | ||
|
||
} // namespace base | ||
|
||
#endif // BASE_FUCHSIA_SCOPED_MX_HANDLE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters