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

Side by Side Diff: sky/sdk/lib/mojo/net/fetch.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/embedder.dart ('k') | sky/sdk/lib/mojo/net/image_cache.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 '../shell.dart' as shell;
6 import 'dart:async'; 5 import 'dart:async';
7 import 'dart:typed_data'; 6 import 'dart:typed_data';
7
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojom/mojo/network_service.mojom.dart'; 9 import 'package:mojom/mojo/network_service.mojom.dart';
10 import 'package:mojom/mojo/url_loader.mojom.dart'; 10 import 'package:mojom/mojo/url_loader.mojom.dart';
11 import 'package:mojom/mojo/url_request.mojom.dart'; 11 import 'package:mojom/mojo/url_request.mojom.dart';
12 import 'package:mojom/mojo/url_response.mojom.dart'; 12 import 'package:mojom/mojo/url_response.mojom.dart';
13 13
14 import '../shell.dart' as shell;
15
14 class Response { 16 class Response {
15 ByteData body; 17 ByteData body;
16 18
17 Response(this.body); 19 Response(this.body);
18 20
19 String bodyAsString() { 21 String bodyAsString() {
20 return new String.fromCharCodes(new Uint8List.view(body.buffer)); 22 return new String.fromCharCodes(new Uint8List.view(body.buffer));
21 } 23 }
22 } 24 }
23 25
(...skipping 19 matching lines...) Expand all
43 return fetch(request); 45 return fetch(request);
44 } 46 }
45 47
46 Future<Response> fetchBody(String relativeUrl) async { 48 Future<Response> fetchBody(String relativeUrl) async {
47 UrlResponse response = await fetchUrl(relativeUrl); 49 UrlResponse response = await fetchUrl(relativeUrl);
48 if (response.body == null) return new Response(null); 50 if (response.body == null) return new Response(null);
49 51
50 ByteData data = await core.DataPipeDrainer.drainHandle(response.body); 52 ByteData data = await core.DataPipeDrainer.drainHandle(response.body);
51 return new Response(data); 53 return new Response(data);
52 } 54 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/mojo/embedder.dart ('k') | sky/sdk/lib/mojo/net/image_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698