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 5part of zircon; 6 7// ignore_for_file: native_function_body_in_non_sdk_code 8// ignore_for_file: public_member_api_docs 9 10@pragma('vm:entry-point') 11class Handle extends NativeFieldWrapperClass2 { 12 // No public constructor - this can only be created from native code. 13 @pragma('vm:entry-point') 14 Handle._(); 15 16 // Create an invalid handle object. 17 factory Handle.invalid() { 18 return _createInvalid(); 19 } 20 static Handle _createInvalid() native 'Handle_CreateInvalid'; 21 22 int get _handle native 'Handle_handle'; 23 24 @override 25 String toString() => 'Handle($_handle)'; 26 27 @override 28 bool operator ==(Object other) => 29 (other is Handle) && (_handle == other._handle); 30 31 @override 32 int get hashCode => _handle.hashCode; 33 34 // Common handle operations. 35 bool get isValid native 'Handle_is_valid'; 36 int close() native 'Handle_Close'; 37 HandleWaiter asyncWait(int signals, AsyncWaitCallback callback) 38 native 'Handle_AsyncWait'; 39 40 Handle duplicate(int rights) native 'Handle_Duplicate'; 41} 42