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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/http_server/http_response.mojom.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Cleanup Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 library http_response_mojom; 5 library http_response_mojom;
6 import 'package:mojo/bindings.dart' as bindings; 6 import 'package:mojo/bindings.dart' as bindings;
7 import 'package:mojo/core.dart' as core; 7 import 'package:mojo/core.dart' as core;
8 8
9 9
10 10
11 11
12 class HttpResponse extends bindings.Struct { 12 class HttpResponse extends bindings.Struct {
13 static const List<bindings.StructDataHeader> kVersions = const [ 13 static const List<bindings.StructDataHeader> kVersions = const [
14 const bindings.StructDataHeader(40, 0) 14 const bindings.StructDataHeader(40, 0)
15 ]; 15 ];
16 int statusCode = 200; 16 int statusCode = 200;
17 core.MojoDataPipeConsumer body = null; 17 core.MojoDataPipeConsumer body = null;
18 int contentLength = 0; 18 int contentLength = 0;
19 String contentType = "text/html; charset=utf-8"; 19 String contentType = "text/html; charset=utf-8";
20 Map<String, String> customHeaders = null; 20 Map<String, String> customHeaders = null;
21 21
22 HttpResponse() : super(kVersions.last.size); 22 HttpResponse() : super(kVersions.last.size);
23 23
24 HttpResponse.init(
25 int this.statusCode,
26 core.MojoDataPipeConsumer this.body,
27 int this.contentLength,
28 String this.contentType,
29 Map<String, String> this.customHeaders
30 ) : super(kVersions.last.size);
31
24 static HttpResponse deserialize(bindings.Message message) { 32 static HttpResponse deserialize(bindings.Message message) {
25 var decoder = new bindings.Decoder(message); 33 var decoder = new bindings.Decoder(message);
26 var result = decode(decoder); 34 var result = decode(decoder);
27 if (decoder.excessHandles != null) { 35 if (decoder.excessHandles != null) {
28 decoder.excessHandles.forEach((h) => h.close()); 36 decoder.excessHandles.forEach((h) => h.close());
29 } 37 }
30 return result; 38 return result;
31 } 39 }
32 40
33 static HttpResponse decode(bindings.Decoder decoder0) { 41 static HttpResponse decode(bindings.Decoder decoder0) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 187 }
180 188
181 Map toJson() { 189 Map toJson() {
182 throw new bindings.MojoCodecError( 190 throw new bindings.MojoCodecError(
183 'Object containing handles cannot be encoded to JSON.'); 191 'Object containing handles cannot be encoded to JSON.');
184 } 192 }
185 } 193 }
186 194
187 195
188 196
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698