Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Unified Diff: mojo/public/dart/src/handle.dart

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/dart/src/event_stream.dart ('k') | mojo/public/dart/src/handle_watcher.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/src/handle.dart
diff --git a/mojo/public/dart/src/handle.dart b/mojo/public/dart/src/handle.dart
deleted file mode 100644
index a81980437d0ea4863a2da33fdabfa910a49484bd..0000000000000000000000000000000000000000
--- a/mojo/public/dart/src/handle.dart
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2014 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.
-
-part of core;
-
-class _MojoHandleNatives {
- static int register(MojoEventStream eventStream) native "MojoHandle_Register";
- static int close(int handle) native "MojoHandle_Close";
- static List wait(int handle, int signals, int deadline)
- native "MojoHandle_Wait";
- static List waitMany(
- List<int> handles, List<int> signals, int deadline)
- native "MojoHandle_WaitMany";
-}
-
-
-class MojoHandle {
- static const int INVALID = 0;
- static const int DEADLINE_INDEFINITE = -1;
-
- int h;
-
- MojoHandle(this.h);
-
- MojoResult close() {
- int result = _MojoHandleNatives.close(h);
- h = INVALID;
- return new MojoResult(result);
- }
-
- MojoWaitResult wait(int signals, int deadline) {
- List result = _MojoHandleNatives.wait(h, signals, deadline);
- return new MojoWaitResult(new MojoResult(result[0]), result[1]);
- }
-
- bool _ready(MojoHandleSignals signal) {
- MojoWaitResult mwr = wait(signal.value, 0);
- switch (mwr.result) {
- case MojoResult.OK:
- return true;
- case MojoResult.DEADLINE_EXCEEDED:
- case MojoResult.CANCELLED:
- case MojoResult.INVALID_ARGUMENT:
- case MojoResult.FAILED_PRECONDITION:
- return false;
- default:
- // Should be unreachable.
- throw "Unexpected result $res for wait on $h";
- }
- }
-
- bool get readyRead => _ready(MojoHandleSignals.READABLE);
- bool get readyWrite => _ready(MojoHandleSignals.WRITABLE);
-
- static MojoWaitManyResult waitMany(
- List<int> handles, List<int> signals, int deadline) {
- List result = _MojoHandleNatives.waitMany(handles, signals, deadline);
- return new MojoWaitManyResult(
- new MojoResult(result[0]), result[1], result[2]);
- }
-
- static MojoResult register(MojoEventStream eventStream) {
- return new MojoResult(_MojoHandleNatives.register(eventStream));
- }
-
- bool get isValid => (h != INVALID);
-
- String toString() => "$h";
-
- bool operator ==(MojoHandle other) {
- return h == other.h;
- }
-}
« no previous file with comments | « mojo/public/dart/src/event_stream.dart ('k') | mojo/public/dart/src/handle_watcher.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698