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

Side by Side Diff: sky/sdk/lib/mojo/net/image_cache.dart

Issue 1189943004: Fork some more files from the old framework, so that the transition will be easier to perform. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « sky/sdk/lib/mojo/net/fetch.dart ('k') | sky/sdk/lib/mojo/shell.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:sky'; 5 import 'dart:sky';
6 import 'dart:collection'; 6 import 'dart:collection';
7
8 import 'package:mojom/mojo/url_response.mojom.dart';
9
7 import 'fetch.dart'; 10 import 'fetch.dart';
8 import 'package:mojom/mojo/url_response.mojom.dart';
9 11
10 final HashMap<String, List<ImageDecoderCallback>> _pendingRequests = 12 final HashMap<String, List<ImageDecoderCallback>> _pendingRequests =
11 new HashMap<String, List<ImageDecoderCallback>>(); 13 new HashMap<String, List<ImageDecoderCallback>>();
12 14
13 final HashMap<String, Image> _completedRequests = 15 final HashMap<String, Image> _completedRequests =
14 new HashMap<String, Image>(); 16 new HashMap<String, Image>();
15 17
16 void _loadComplete(url, image) { 18 void _loadComplete(url, image) {
17 _completedRequests[url] = image; 19 _completedRequests[url] = image;
18 _pendingRequests[url].forEach((c) => c(image)); 20 _pendingRequests[url].forEach((c) => c(image));
(...skipping 16 matching lines...) Expand all
35 fetchUrl(url).then((UrlResponse response) { 37 fetchUrl(url).then((UrlResponse response) {
36 if (response.statusCode >= 400) { 38 if (response.statusCode >= 400) {
37 _loadComplete(url, null); 39 _loadComplete(url, null);
38 return; 40 return;
39 } 41 }
40 new ImageDecoder(response.body.handle.h, 42 new ImageDecoder(response.body.handle.h,
41 (image) => _loadComplete(url, image)); 43 (image) => _loadComplete(url, image));
42 }); 44 });
43 } 45 }
44 } 46 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/mojo/net/fetch.dart ('k') | sky/sdk/lib/mojo/shell.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698