| OLD | NEW |
| 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 url_response_disk_cache_mojom; | 5 library url_response_disk_cache_mojom; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
| 10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| 11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 11 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; | 13 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; |
| 12 | 14 |
| 13 | 15 |
| 14 | 16 |
| 15 class _UrlResponseDiskCacheGetParams extends bindings.Struct { | 17 class _UrlResponseDiskCacheGetParams extends bindings.Struct { |
| 16 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
| 17 const bindings.StructDataHeader(16, 0) | 19 const bindings.StructDataHeader(16, 0) |
| 18 ]; | 20 ]; |
| 19 String url = null; | 21 String url = null; |
| 20 | 22 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 74 } |
| 73 | 75 |
| 74 Map toJson() { | 76 Map toJson() { |
| 75 Map map = new Map(); | 77 Map map = new Map(); |
| 76 map["url"] = url; | 78 map["url"] = url; |
| 77 return map; | 79 return map; |
| 78 } | 80 } |
| 79 } | 81 } |
| 80 | 82 |
| 81 | 83 |
| 84 |
| 85 |
| 82 class UrlResponseDiskCacheGetResponseParams extends bindings.Struct { | 86 class UrlResponseDiskCacheGetResponseParams extends bindings.Struct { |
| 83 static const List<bindings.StructDataHeader> kVersions = const [ | 87 static const List<bindings.StructDataHeader> kVersions = const [ |
| 84 const bindings.StructDataHeader(32, 0) | 88 const bindings.StructDataHeader(32, 0) |
| 85 ]; | 89 ]; |
| 86 url_response_mojom.UrlResponse response = null; | 90 url_response_mojom.UrlResponse response = null; |
| 87 List<int> filePath = null; | 91 List<int> filePath = null; |
| 88 List<int> cacheDirPath = null; | 92 List<int> cacheDirPath = null; |
| 89 | 93 |
| 90 UrlResponseDiskCacheGetResponseParams() : super(kVersions.last.size); | 94 UrlResponseDiskCacheGetResponseParams() : super(kVersions.last.size); |
| 91 | 95 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 "cacheDirPath: $cacheDirPath" ")"; | 159 "cacheDirPath: $cacheDirPath" ")"; |
| 156 } | 160 } |
| 157 | 161 |
| 158 Map toJson() { | 162 Map toJson() { |
| 159 throw new bindings.MojoCodecError( | 163 throw new bindings.MojoCodecError( |
| 160 'Object containing handles cannot be encoded to JSON.'); | 164 'Object containing handles cannot be encoded to JSON.'); |
| 161 } | 165 } |
| 162 } | 166 } |
| 163 | 167 |
| 164 | 168 |
| 169 |
| 170 |
| 165 class _UrlResponseDiskCacheValidateParams extends bindings.Struct { | 171 class _UrlResponseDiskCacheValidateParams extends bindings.Struct { |
| 166 static const List<bindings.StructDataHeader> kVersions = const [ | 172 static const List<bindings.StructDataHeader> kVersions = const [ |
| 167 const bindings.StructDataHeader(16, 0) | 173 const bindings.StructDataHeader(16, 0) |
| 168 ]; | 174 ]; |
| 169 String url = null; | 175 String url = null; |
| 170 | 176 |
| 171 _UrlResponseDiskCacheValidateParams() : super(kVersions.last.size); | 177 _UrlResponseDiskCacheValidateParams() : super(kVersions.last.size); |
| 172 | 178 |
| 173 static _UrlResponseDiskCacheValidateParams deserialize(bindings.Message messag
e) { | 179 static _UrlResponseDiskCacheValidateParams deserialize(bindings.Message messag
e) { |
| 174 var decoder = new bindings.Decoder(message); | 180 var decoder = new bindings.Decoder(message); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 228 } |
| 223 | 229 |
| 224 Map toJson() { | 230 Map toJson() { |
| 225 Map map = new Map(); | 231 Map map = new Map(); |
| 226 map["url"] = url; | 232 map["url"] = url; |
| 227 return map; | 233 return map; |
| 228 } | 234 } |
| 229 } | 235 } |
| 230 | 236 |
| 231 | 237 |
| 238 |
| 239 |
| 232 class _UrlResponseDiskCacheUpdateParams extends bindings.Struct { | 240 class _UrlResponseDiskCacheUpdateParams extends bindings.Struct { |
| 233 static const List<bindings.StructDataHeader> kVersions = const [ | 241 static const List<bindings.StructDataHeader> kVersions = const [ |
| 234 const bindings.StructDataHeader(16, 0) | 242 const bindings.StructDataHeader(16, 0) |
| 235 ]; | 243 ]; |
| 236 url_response_mojom.UrlResponse response = null; | 244 url_response_mojom.UrlResponse response = null; |
| 237 | 245 |
| 238 _UrlResponseDiskCacheUpdateParams() : super(kVersions.last.size); | 246 _UrlResponseDiskCacheUpdateParams() : super(kVersions.last.size); |
| 239 | 247 |
| 240 static _UrlResponseDiskCacheUpdateParams deserialize(bindings.Message message)
{ | 248 static _UrlResponseDiskCacheUpdateParams deserialize(bindings.Message message)
{ |
| 241 var decoder = new bindings.Decoder(message); | 249 var decoder = new bindings.Decoder(message); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 "response: $response" ")"; | 297 "response: $response" ")"; |
| 290 } | 298 } |
| 291 | 299 |
| 292 Map toJson() { | 300 Map toJson() { |
| 293 throw new bindings.MojoCodecError( | 301 throw new bindings.MojoCodecError( |
| 294 'Object containing handles cannot be encoded to JSON.'); | 302 'Object containing handles cannot be encoded to JSON.'); |
| 295 } | 303 } |
| 296 } | 304 } |
| 297 | 305 |
| 298 | 306 |
| 307 |
| 308 |
| 299 class _UrlResponseDiskCacheUpdateAndGetParams extends bindings.Struct { | 309 class _UrlResponseDiskCacheUpdateAndGetParams extends bindings.Struct { |
| 300 static const List<bindings.StructDataHeader> kVersions = const [ | 310 static const List<bindings.StructDataHeader> kVersions = const [ |
| 301 const bindings.StructDataHeader(16, 0) | 311 const bindings.StructDataHeader(16, 0) |
| 302 ]; | 312 ]; |
| 303 url_response_mojom.UrlResponse response = null; | 313 url_response_mojom.UrlResponse response = null; |
| 304 | 314 |
| 305 _UrlResponseDiskCacheUpdateAndGetParams() : super(kVersions.last.size); | 315 _UrlResponseDiskCacheUpdateAndGetParams() : super(kVersions.last.size); |
| 306 | 316 |
| 307 static _UrlResponseDiskCacheUpdateAndGetParams deserialize(bindings.Message me
ssage) { | 317 static _UrlResponseDiskCacheUpdateAndGetParams deserialize(bindings.Message me
ssage) { |
| 308 var decoder = new bindings.Decoder(message); | 318 var decoder = new bindings.Decoder(message); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 "response: $response" ")"; | 366 "response: $response" ")"; |
| 357 } | 367 } |
| 358 | 368 |
| 359 Map toJson() { | 369 Map toJson() { |
| 360 throw new bindings.MojoCodecError( | 370 throw new bindings.MojoCodecError( |
| 361 'Object containing handles cannot be encoded to JSON.'); | 371 'Object containing handles cannot be encoded to JSON.'); |
| 362 } | 372 } |
| 363 } | 373 } |
| 364 | 374 |
| 365 | 375 |
| 376 |
| 377 |
| 366 class UrlResponseDiskCacheUpdateAndGetResponseParams extends bindings.Struct { | 378 class UrlResponseDiskCacheUpdateAndGetResponseParams extends bindings.Struct { |
| 367 static const List<bindings.StructDataHeader> kVersions = const [ | 379 static const List<bindings.StructDataHeader> kVersions = const [ |
| 368 const bindings.StructDataHeader(24, 0) | 380 const bindings.StructDataHeader(24, 0) |
| 369 ]; | 381 ]; |
| 370 List<int> filePath = null; | 382 List<int> filePath = null; |
| 371 List<int> cacheDirPath = null; | 383 List<int> cacheDirPath = null; |
| 372 | 384 |
| 373 UrlResponseDiskCacheUpdateAndGetResponseParams() : super(kVersions.last.size); | 385 UrlResponseDiskCacheUpdateAndGetResponseParams() : super(kVersions.last.size); |
| 374 | 386 |
| 375 static UrlResponseDiskCacheUpdateAndGetResponseParams deserialize(bindings.Mes
sage message) { | 387 static UrlResponseDiskCacheUpdateAndGetResponseParams deserialize(bindings.Mes
sage message) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 444 |
| 433 Map toJson() { | 445 Map toJson() { |
| 434 Map map = new Map(); | 446 Map map = new Map(); |
| 435 map["filePath"] = filePath; | 447 map["filePath"] = filePath; |
| 436 map["cacheDirPath"] = cacheDirPath; | 448 map["cacheDirPath"] = cacheDirPath; |
| 437 return map; | 449 return map; |
| 438 } | 450 } |
| 439 } | 451 } |
| 440 | 452 |
| 441 | 453 |
| 454 |
| 455 |
| 442 class _UrlResponseDiskCacheUpdateAndGetExtractedParams extends bindings.Struct { | 456 class _UrlResponseDiskCacheUpdateAndGetExtractedParams extends bindings.Struct { |
| 443 static const List<bindings.StructDataHeader> kVersions = const [ | 457 static const List<bindings.StructDataHeader> kVersions = const [ |
| 444 const bindings.StructDataHeader(16, 0) | 458 const bindings.StructDataHeader(16, 0) |
| 445 ]; | 459 ]; |
| 446 url_response_mojom.UrlResponse response = null; | 460 url_response_mojom.UrlResponse response = null; |
| 447 | 461 |
| 448 _UrlResponseDiskCacheUpdateAndGetExtractedParams() : super(kVersions.last.size
); | 462 _UrlResponseDiskCacheUpdateAndGetExtractedParams() : super(kVersions.last.size
); |
| 449 | 463 |
| 450 static _UrlResponseDiskCacheUpdateAndGetExtractedParams deserialize(bindings.M
essage message) { | 464 static _UrlResponseDiskCacheUpdateAndGetExtractedParams deserialize(bindings.M
essage message) { |
| 451 var decoder = new bindings.Decoder(message); | 465 var decoder = new bindings.Decoder(message); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 "response: $response" ")"; | 513 "response: $response" ")"; |
| 500 } | 514 } |
| 501 | 515 |
| 502 Map toJson() { | 516 Map toJson() { |
| 503 throw new bindings.MojoCodecError( | 517 throw new bindings.MojoCodecError( |
| 504 'Object containing handles cannot be encoded to JSON.'); | 518 'Object containing handles cannot be encoded to JSON.'); |
| 505 } | 519 } |
| 506 } | 520 } |
| 507 | 521 |
| 508 | 522 |
| 523 |
| 524 |
| 509 class UrlResponseDiskCacheUpdateAndGetExtractedResponseParams extends bindings.S
truct { | 525 class UrlResponseDiskCacheUpdateAndGetExtractedResponseParams extends bindings.S
truct { |
| 510 static const List<bindings.StructDataHeader> kVersions = const [ | 526 static const List<bindings.StructDataHeader> kVersions = const [ |
| 511 const bindings.StructDataHeader(24, 0) | 527 const bindings.StructDataHeader(24, 0) |
| 512 ]; | 528 ]; |
| 513 List<int> extractedDirPath = null; | 529 List<int> extractedDirPath = null; |
| 514 List<int> cacheDirPath = null; | 530 List<int> cacheDirPath = null; |
| 515 | 531 |
| 516 UrlResponseDiskCacheUpdateAndGetExtractedResponseParams() : super(kVersions.la
st.size); | 532 UrlResponseDiskCacheUpdateAndGetExtractedResponseParams() : super(kVersions.la
st.size); |
| 517 | 533 |
| 518 static UrlResponseDiskCacheUpdateAndGetExtractedResponseParams deserialize(bin
dings.Message message) { | 534 static UrlResponseDiskCacheUpdateAndGetExtractedResponseParams deserialize(bin
dings.Message message) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 590 } |
| 575 | 591 |
| 576 Map toJson() { | 592 Map toJson() { |
| 577 Map map = new Map(); | 593 Map map = new Map(); |
| 578 map["extractedDirPath"] = extractedDirPath; | 594 map["extractedDirPath"] = extractedDirPath; |
| 579 map["cacheDirPath"] = cacheDirPath; | 595 map["cacheDirPath"] = cacheDirPath; |
| 580 return map; | 596 return map; |
| 581 } | 597 } |
| 582 } | 598 } |
| 583 | 599 |
| 600 |
| 601 |
| 602 |
| 584 const int _UrlResponseDiskCache_getName = 0; | 603 const int _UrlResponseDiskCache_getName = 0; |
| 585 const int _UrlResponseDiskCache_validateName = 1; | 604 const int _UrlResponseDiskCache_validateName = 1; |
| 586 const int _UrlResponseDiskCache_updateName = 2; | 605 const int _UrlResponseDiskCache_updateName = 2; |
| 587 const int _UrlResponseDiskCache_updateAndGetName = 3; | 606 const int _UrlResponseDiskCache_updateAndGetName = 3; |
| 588 const int _UrlResponseDiskCache_updateAndGetExtractedName = 4; | 607 const int _UrlResponseDiskCache_updateAndGetExtractedName = 4; |
| 589 | 608 |
| 609 |
| 610 |
| 611 class _UrlResponseDiskCacheServiceDescription implements service_describer.Servi
ceDescription { |
| 612 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 613 |
| 614 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 615 |
| 616 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 617 } |
| 618 |
| 590 abstract class UrlResponseDiskCache { | 619 abstract class UrlResponseDiskCache { |
| 591 static const String serviceName = "mojo::URLResponseDiskCache"; | 620 static const String serviceName = "mojo::URLResponseDiskCache"; |
| 592 dynamic get(String url,[Function responseFactory = null]); | 621 dynamic get(String url,[Function responseFactory = null]); |
| 593 void validate(String url); | 622 void validate(String url); |
| 594 void update(url_response_mojom.UrlResponse response); | 623 void update(url_response_mojom.UrlResponse response); |
| 595 dynamic updateAndGet(url_response_mojom.UrlResponse response,[Function respons
eFactory = null]); | 624 dynamic updateAndGet(url_response_mojom.UrlResponse response,[Function respons
eFactory = null]); |
| 596 dynamic updateAndGetExtracted(url_response_mojom.UrlResponse response,[Functio
n responseFactory = null]); | 625 dynamic updateAndGetExtracted(url_response_mojom.UrlResponse response,[Functio
n responseFactory = null]); |
| 597 } | 626 } |
| 598 | 627 |
| 599 | 628 |
| 600 class _UrlResponseDiskCacheProxyImpl extends bindings.Proxy { | 629 class _UrlResponseDiskCacheProxyImpl extends bindings.Proxy { |
| 601 _UrlResponseDiskCacheProxyImpl.fromEndpoint( | 630 _UrlResponseDiskCacheProxyImpl.fromEndpoint( |
| 602 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 631 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 603 | 632 |
| 604 _UrlResponseDiskCacheProxyImpl.fromHandle(core.MojoHandle handle) : | 633 _UrlResponseDiskCacheProxyImpl.fromHandle(core.MojoHandle handle) : |
| 605 super.fromHandle(handle); | 634 super.fromHandle(handle); |
| 606 | 635 |
| 607 _UrlResponseDiskCacheProxyImpl.unbound() : super.unbound(); | 636 _UrlResponseDiskCacheProxyImpl.unbound() : super.unbound(); |
| 608 | 637 |
| 609 static _UrlResponseDiskCacheProxyImpl newFromEndpoint( | 638 static _UrlResponseDiskCacheProxyImpl newFromEndpoint( |
| 610 core.MojoMessagePipeEndpoint endpoint) { | 639 core.MojoMessagePipeEndpoint endpoint) { |
| 611 assert(endpoint.setDescription("For _UrlResponseDiskCacheProxyImpl")); | 640 assert(endpoint.setDescription("For _UrlResponseDiskCacheProxyImpl")); |
| 612 return new _UrlResponseDiskCacheProxyImpl.fromEndpoint(endpoint); | 641 return new _UrlResponseDiskCacheProxyImpl.fromEndpoint(endpoint); |
| 613 } | 642 } |
| 614 | 643 |
| 644 service_describer.ServiceDescription get serviceDescription => |
| 645 new _UrlResponseDiskCacheServiceDescription(); |
| 646 |
| 615 void handleResponse(bindings.ServiceMessage message) { | 647 void handleResponse(bindings.ServiceMessage message) { |
| 616 switch (message.header.type) { | 648 switch (message.header.type) { |
| 617 case _UrlResponseDiskCache_getName: | 649 case _UrlResponseDiskCache_getName: |
| 618 var r = UrlResponseDiskCacheGetResponseParams.deserialize( | 650 var r = UrlResponseDiskCacheGetResponseParams.deserialize( |
| 619 message.payload); | 651 message.payload); |
| 620 if (!message.header.hasRequestId) { | 652 if (!message.header.hasRequestId) { |
| 621 proxyError("Expected a message with a valid request Id."); | 653 proxyError("Expected a message with a valid request Id."); |
| 622 return; | 654 return; |
| 623 } | 655 } |
| 624 Completer c = completerMap[message.header.requestId]; | 656 Completer c = completerMap[message.header.requestId]; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 assert(_impl == null); | 966 assert(_impl == null); |
| 935 _impl = d; | 967 _impl = d; |
| 936 } | 968 } |
| 937 | 969 |
| 938 String toString() { | 970 String toString() { |
| 939 var superString = super.toString(); | 971 var superString = super.toString(); |
| 940 return "UrlResponseDiskCacheStub($superString)"; | 972 return "UrlResponseDiskCacheStub($superString)"; |
| 941 } | 973 } |
| 942 | 974 |
| 943 int get version => 0; | 975 int get version => 0; |
| 976 |
| 977 service_describer.ServiceDescription get serviceDescription => |
| 978 new _UrlResponseDiskCacheServiceDescription(); |
| 944 } | 979 } |
| 945 | 980 |
| 946 | 981 |
| 982 |
| OLD | NEW |