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

Unified Diff: packages/barback/lib/src/asset/internal_asset.dart

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 years, 3 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 | « packages/barback/lib/src/asset/asset_set.dart ('k') | packages/barback/lib/src/barback.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/barback/lib/src/asset/internal_asset.dart
diff --git a/packages/barback/lib/src/asset/internal_asset.dart b/packages/barback/lib/src/asset/internal_asset.dart
index ed7f3093155e1673bdda7cc104742afb98bbcd01..ead30c4c6e1e4dee51abd93f100da0d537dd9416 100644
--- a/packages/barback/lib/src/asset/internal_asset.dart
+++ b/packages/barback/lib/src/asset/internal_asset.dart
@@ -22,23 +22,11 @@ import 'asset_id.dart';
Map serializeAsset(Asset asset) {
var id = serializeId(asset.id);
if (asset is BinaryAsset) {
- return {
- 'type': 'binary',
- 'id': id,
- 'contents': asset._contents
- };
+ return {'type': 'binary', 'id': id, 'contents': asset._contents};
} else if (asset is FileAsset) {
- return {
- 'type': 'file',
- 'id': id,
- 'path': asset._path
- };
+ return {'type': 'file', 'id': id, 'path': asset._path};
} else if (asset is StringAsset) {
- return {
- 'type': 'string',
- 'id': id,
- 'contents': asset._contents
- };
+ return {'type': 'string', 'id': id, 'contents': asset._contents};
} else {
// [asset] is probably a [StreamAsset], but it's possible that the user has
// created a custom subclass, in which case we just serialize the stream
@@ -58,8 +46,10 @@ Asset deserializeAsset(Map asset) {
case 'binary':
return new BinaryAsset(
id, DelegatingList.typed(asset['contents'] as List));
- case 'file': return new FileAsset(id, asset['path']);
- case 'string': return new StringAsset(id, asset['contents']);
+ case 'file':
+ return new FileAsset(id, asset['path']);
+ case 'string':
+ return new StringAsset(id, asset['contents']);
case 'stream':
return new StreamAsset(
id, DelegatingStream.typed(deserializeStream(asset['stream'])));
@@ -74,8 +64,7 @@ class BinaryAsset implements Asset {
final Uint8List _contents;
- BinaryAsset(this.id, List<int> contents)
- : _contents = toUint8List(contents);
+ BinaryAsset(this.id, List<int> contents) : _contents = toUint8List(contents);
Future<String> readAsString({Encoding encoding}) {
if (encoding == null) encoding = UTF8;
@@ -153,8 +142,9 @@ class StringAsset implements Asset {
// Don't show the whole string if it's long.
var contents = _contents;
if (contents.length > 40) {
- contents = contents.substring(0, 20) + " ... " +
- contents.substring(contents.length - 20);
+ contents = contents.substring(0, 20) +
+ " ... " +
+ contents.substring(contents.length - 20);
}
contents = _escape(contents);
@@ -183,7 +173,10 @@ class StreamAsset implements Asset {
Future<String> readAsString({Encoding encoding}) {
if (encoding == null) encoding = UTF8;
- return _replayer.getReplay().expand((chunk) => chunk).toList()
+ return _replayer
+ .getReplay()
+ .expand((chunk) => chunk)
+ .toList()
.then((bytes) => encoding.decode(bytes));
}
« no previous file with comments | « packages/barback/lib/src/asset/asset_set.dart ('k') | packages/barback/lib/src/barback.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698