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

Unified Diff: pkg/third_party/html5lib/lib/parser_console.dart

Issue 814113004: Pull args, intl, logging, shelf, and source_maps out of the SDK. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also csslib. Created 6 years 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 | « pkg/third_party/html5lib/lib/parser.dart ('k') | pkg/third_party/html5lib/lib/src/char_encodings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/third_party/html5lib/lib/parser_console.dart
diff --git a/pkg/third_party/html5lib/lib/parser_console.dart b/pkg/third_party/html5lib/lib/parser_console.dart
deleted file mode 100644
index 515f891c45cf3b242bc3b7e5ebc6134a7e9117ef..0000000000000000000000000000000000000000
--- a/pkg/third_party/html5lib/lib/parser_console.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-/// This library adds `dart:io` support to the HTML5 parser. Call
-/// [initDartIOSupport] before calling the [parse] methods and they will accept
-/// a [RandomAccessFile] as input, in addition to the other input types.
-library parser_console;
-
-import 'dart:io';
-import 'parser.dart';
-import 'src/inputstream.dart' as inputstream;
-
-/// Adds support to the [HtmlParser] for running on a console VM. In particular
-/// this means it will be able to handle `dart:io` and [RandomAccessFile]s as
-/// input to the various [parse] methods.
-void useConsole() {
- inputstream.consoleSupport = new _ConsoleSupport();
-}
-
-class _ConsoleSupport extends inputstream.ConsoleSupport {
- List<int> bytesFromFile(source) {
- if (source is! RandomAccessFile) return null;
- return readAllBytesFromFile(source);
- }
-}
-
-// TODO(jmesserly): this should be `RandomAccessFile.readAllBytes`.
-/// Synchronously reads all bytes from the [file].
-List<int> readAllBytesFromFile(RandomAccessFile file) {
- int length = file.lengthSync();
- var bytes = new List<int>(length);
-
- int bytesRead = 0;
- while (bytesRead < length) {
- int read = file.readIntoSync(bytes, bytesRead, length - bytesRead);
- if (read <= 0) {
- // This could happen if, for example, the file was resized while
- // we're reading. Just shrink the bytes array and move on.
- bytes = bytes.sublist(0, bytesRead);
- break;
- }
- bytesRead += read;
- }
- return bytes;
-}
« no previous file with comments | « pkg/third_party/html5lib/lib/parser.dart ('k') | pkg/third_party/html5lib/lib/src/char_encodings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698