Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
unique_fdio_ns.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_UNIQUE_FDIO_NS_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_UNIQUE_FDIO_NS_H_
7
8#include "flutter/fml/logging.h"
9#include "flutter/fml/unique_object.h"
10#include "lib/fdio/namespace.h"
11
12namespace flutter_runner {
13
15 static fdio_ns_t* InvalidValue() { return nullptr; }
16
17 static bool IsValid(fdio_ns_t* ns) { return ns != InvalidValue(); }
18
19 static void Free(fdio_ns_t* ns) {
20 auto status = fdio_ns_destroy(ns);
21 FML_DCHECK(status == ZX_OK);
22 }
23};
24
26
28 fdio_ns_t* ns = nullptr;
29 if (fdio_ns_create(&ns) == ZX_OK) {
30 return UniqueFDIONS{ns};
31 }
32 return UniqueFDIONS{nullptr};
33}
34
35} // namespace flutter_runner
36
37#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_UNIQUE_FDIO_NS_H_
#define FML_DCHECK(condition)
Definition logging.h:103
UniqueFDIONS UniqueFDIONSCreate()
static void Free(fdio_ns_t *ns)
static bool IsValid(fdio_ns_t *ns)