Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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 <lib/fdio/namespace.h>
9
10#include "flutter/fml/logging.h"
12
13namespace flutter_runner {
14
16 static fdio_ns_t* InvalidValue() { return nullptr; }
17
18 static bool IsValid(fdio_ns_t* ns) { return ns != InvalidValue(); }
19
20 static void Free(fdio_ns_t* ns) {
21 auto status = fdio_ns_destroy(ns);
22 FML_DCHECK(status == ZX_OK);
23 }
24};
25
27
29 fdio_ns_t* ns = nullptr;
30 if (fdio_ns_create(&ns) == ZX_OK) {
31 return UniqueFDIONS{ns};
32 }
33 return UniqueFDIONS{nullptr};
34}
35
36} // namespace flutter_runner
37
38#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_UNIQUE_FDIO_NS_H_
#define FML_DCHECK(condition)
Definition logging.h:122
UniqueFDIONS UniqueFDIONSCreate()
static void Free(fdio_ns_t *ns)
static bool IsValid(fdio_ns_t *ns)