Flutter Engine
The Flutter Engine
handle_disposition.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_DART_PKG_ZIRCON_SDK_EXT_HANDLE_DISPOSITION_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_SDK_EXT_HANDLE_DISPOSITION_H_
7
8#include <zircon/syscalls.h>
9
10#include <vector>
11
12#include "flutter/fml/memory/ref_counted.h"
13#include "handle.h"
14#include "third_party/dart/runtime/include/dart_api.h"
17
18namespace zircon {
19namespace dart {
20/**
21 * HandleDisposition is the native peer of a Dart object (HandleDisposition
22 * in dart:zircon) that holds a Handle and additional properties.
23 */
24class HandleDisposition : public fml::RefCountedThreadSafe<HandleDisposition>,
26 DEFINE_WRAPPERTYPEINFO();
27 FML_FRIEND_REF_COUNTED_THREAD_SAFE(HandleDisposition);
28 FML_FRIEND_MAKE_REF_COUNTED(HandleDisposition);
29
30 public:
31 static void RegisterNatives(tonic::DartLibraryNatives* natives);
32
35 zx_obj_type_t type,
36 zx_rights_t rights);
37
38 zx_handle_op_t operation() const { return operation_; }
39 fml::RefPtr<dart::Handle> handle() const { return handle_; }
40 zx_obj_type_t type() const { return type_; }
41 zx_rights_t rights() const { return rights_; }
42 zx_status_t result() const { return result_; }
43 void set_result(zx_status_t result) { result_ = result; }
44
45 private:
46 explicit HandleDisposition(zx_handle_op_t operation,
48 zx_obj_type_t type,
49 zx_rights_t rights,
50 zx_status_t result)
51 : operation_(operation),
52 handle_(handle),
53 type_(type),
54 rights_(rights),
55 result_(result) {}
56
57 void RetainDartWrappableReference() const override { AddRef(); }
58
59 void ReleaseDartWrappableReference() const override { Release(); }
60
61 const zx_handle_op_t operation_;
62 const fml::RefPtr<dart::Handle> handle_;
63 const zx_obj_type_t type_;
64 const zx_rights_t rights_;
65 zx_status_t result_;
66};
67
68} // namespace dart
69} // namespace zircon
70
71#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_SDK_EXT_HANDLE_DISPOSITION_H_
zx_handle_op_t operation() const
fml::RefPtr< dart::Handle > handle() const
static fml::RefPtr< HandleDisposition > create(zx_handle_op_t operation, fml::RefPtr< dart::Handle > handle, zx_obj_type_t type, zx_rights_t rights)
void set_result(zx_status_t result)
static void RegisterNatives(tonic::DartLibraryNatives *natives)
Definition: dart_vm.cc:33
Definition: handle.cc:14