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

Side by Side Diff: runtime/bin/common.dart

Issue 11275035: Introduce (private) ZLibFilter to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add InternalError class and LICENSE file. Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Constants used when working with native ports. 5 // Constants used when working with native ports.
6 const int _SUCCESS_RESPONSE = 0; 6 const int _SUCCESS_RESPONSE = 0;
7 const int _ILLEGAL_ARGUMENT_RESPONSE = 1; 7 const int _ILLEGAL_ARGUMENT_RESPONSE = 1;
8 const int _OSERROR_RESPONSE = 2; 8 const int _OSERROR_RESPONSE = 2;
9 const int _FILE_CLOSED_RESPONSE = 3; 9 const int _FILE_CLOSED_RESPONSE = 3;
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 */ 47 */
48 final String message; 48 final String message;
49 49
50 /** 50 /**
51 * Error code supplied by the operating system. Will have the value 51 * Error code supplied by the operating system. Will have the value
52 * [noErrorCode] if there is no error code associated with the error. 52 * [noErrorCode] if there is no error code associated with the error.
53 */ 53 */
54 final int errorCode; 54 final int errorCode;
55 } 55 }
56 56
57 /**
58 * An [InternalError] can be thrown from native calls when an error occours
59 * inside native code.
60 */
61 class InternalError {
62 const InternalError([String this.message = ""]);
63
64 String toString() {
65 if (message.isEmpty) return "InternalError";
66 return "InternalError: $message";
67 }
68
69 final String message;
70 }
71
57 72
58 // Check if a List is a builtin VM List type. Returns true 73 // Check if a List is a builtin VM List type. Returns true
59 // if the List is a builtin VM List type and false if it is 74 // if the List is a builtin VM List type and false if it is
60 // a user defined List type. 75 // a user defined List type.
61 bool _isBuiltinList(List buffer) native "Common_IsBuiltinList"; 76 bool _isBuiltinList(List buffer) native "Common_IsBuiltinList";
62 77
63 78
64 // Object for holding a buffer and an offset. 79 // Object for holding a buffer and an offset.
65 class _BufferAndOffset { 80 class _BufferAndOffset {
66 _BufferAndOffset(List this.buffer, int this.offset); 81 _BufferAndOffset(List this.buffer, int this.offset);
(...skipping 16 matching lines...) Expand all
83 for (int i = 0; i < bytes; i++) { 98 for (int i = 0; i < bytes; i++) {
84 int value = buffer[j]; 99 int value = buffer[j];
85 if (value is! int) { 100 if (value is! int) {
86 throw new FileIOException("List element is not an integer at index $j"); 101 throw new FileIOException("List element is not an integer at index $j");
87 } 102 }
88 newBuffer[i] = value; 103 newBuffer[i] = value;
89 j++; 104 j++;
90 } 105 }
91 return new _BufferAndOffset(newBuffer, 0); 106 return new _BufferAndOffset(newBuffer, 0);
92 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698