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

Side by Side Diff: sdk/lib/io/data_transformer.dart

Issue 218493012: Make non-copying version of BytesBuidler and make file-reads faster. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/bytes_builder.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Exposes ZLib options for input parameters. 8 * Exposes ZLib options for input parameters.
9 * 9 *
10 * See http://www.zlib.net/manual.html for more documentation. 10 * See http://www.zlib.net/manual.html for more documentation.
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 ByteConversionSink startChunkedConversion(Sink<List<int>> sink) { 427 ByteConversionSink startChunkedConversion(Sink<List<int>> sink) {
428 if (sink is! ByteConversionSink) { 428 if (sink is! ByteConversionSink) {
429 sink = new ByteConversionSink.from(sink); 429 sink = new ByteConversionSink.from(sink);
430 } 430 }
431 return new _ZLibDecoderSink(sink, windowBits, dictionary, raw); 431 return new _ZLibDecoderSink(sink, windowBits, dictionary, raw);
432 } 432 }
433 } 433 }
434 434
435 435
436 class _BufferSink extends ByteConversionSink { 436 class _BufferSink extends ByteConversionSink {
437 final BytesBuilder builder = new BytesBuilder(); 437 final BytesBuilder builder = new BytesBuilder(copy: false);
438 438
439 void add(List<int> chunk) { 439 void add(List<int> chunk) {
440 builder.add(chunk); 440 builder.add(chunk);
441 } 441 }
442 442
443 void addSlice(List<int> chunk, int start, int end, bool isLast) { 443 void addSlice(List<int> chunk, int start, int end, bool isLast) {
444 if (chunk is Uint8List) { 444 if (chunk is Uint8List) {
445 Uint8List list = chunk; 445 Uint8List list = chunk;
446 builder.add(new Uint8List.view(list.buffer, start, end - start)); 446 builder.add(new Uint8List.view(list.buffer, start, end - start));
447 } else { 447 } else {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } 586 }
587 587
588 void _validateZLibStrategy(int strategy) { 588 void _validateZLibStrategy(int strategy) {
589 const strategies = const <int>[ZLibOption.STRATEGY_FILTERED, 589 const strategies = const <int>[ZLibOption.STRATEGY_FILTERED,
590 ZLibOption.STRATEGY_HUFFMAN_ONLY, ZLibOption.STRATEGY_RLE, 590 ZLibOption.STRATEGY_HUFFMAN_ONLY, ZLibOption.STRATEGY_RLE,
591 ZLibOption.STRATEGY_FIXED, ZLibOption.STRATEGY_DEFAULT]; 591 ZLibOption.STRATEGY_FIXED, ZLibOption.STRATEGY_DEFAULT];
592 if (strategies.indexOf(strategy) == -1) { 592 if (strategies.indexOf(strategy) == -1) {
593 throw new ArgumentError("Unsupported 'strategy'"); 593 throw new ArgumentError("Unsupported 'strategy'");
594 } 594 }
595 } 595 }
OLDNEW
« no previous file with comments | « sdk/lib/io/bytes_builder.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698