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 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:mojo/bindings.dart' as bindings; | 7 import 'package:mojo/bindings.dart' as bindings; |
8 import 'package:mojo/core.dart' as core; | 8 import 'package:mojo/core.dart' as core; |
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
10 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; | 10 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 659 |
660 abstract class UrlResponseDiskCache { | 660 abstract class UrlResponseDiskCache { |
661 static const String serviceName = "mojo::URLResponseDiskCache"; | 661 static const String serviceName = "mojo::URLResponseDiskCache"; |
662 dynamic get(String url,[Function responseFactory = null]); | 662 dynamic get(String url,[Function responseFactory = null]); |
663 void validate(String url); | 663 void validate(String url); |
664 void update(url_response_mojom.UrlResponse response); | 664 void update(url_response_mojom.UrlResponse response); |
665 dynamic updateAndGet(url_response_mojom.UrlResponse response,[Function respons
eFactory = null]); | 665 dynamic updateAndGet(url_response_mojom.UrlResponse response,[Function respons
eFactory = null]); |
666 dynamic updateAndGetExtracted(url_response_mojom.UrlResponse response,[Functio
n responseFactory = null]); | 666 dynamic updateAndGetExtracted(url_response_mojom.UrlResponse response,[Functio
n responseFactory = null]); |
667 } | 667 } |
668 | 668 |
669 | 669 class _UrlResponseDiskCacheProxyControl |
670 class _UrlResponseDiskCacheProxyControl extends bindings.ProxyMessageHandler | 670 extends bindings.ProxyMessageHandler |
671 implements bindings.ProxyControl { | 671 implements bindings.ProxyControl { |
672 _UrlResponseDiskCacheProxyControl.fromEndpoint( | 672 _UrlResponseDiskCacheProxyControl.fromEndpoint( |
673 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 673 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
674 | 674 |
675 _UrlResponseDiskCacheProxyControl.fromHandle( | 675 _UrlResponseDiskCacheProxyControl.fromHandle( |
676 core.MojoHandle handle) : super.fromHandle(handle); | 676 core.MojoHandle handle) : super.fromHandle(handle); |
677 | 677 |
678 _UrlResponseDiskCacheProxyControl.unbound() : super.unbound(); | 678 _UrlResponseDiskCacheProxyControl.unbound() : super.unbound(); |
679 | 679 |
680 service_describer.ServiceDescription get serviceDescription => | 680 service_describer.ServiceDescription get serviceDescription => |
681 new _UrlResponseDiskCacheServiceDescription(); | 681 new _UrlResponseDiskCacheServiceDescription(); |
682 | 682 |
683 String get serviceName => UrlResponseDiskCache.serviceName; | 683 String get serviceName => UrlResponseDiskCache.serviceName; |
684 | 684 |
685 @override | |
686 void handleResponse(bindings.ServiceMessage message) { | 685 void handleResponse(bindings.ServiceMessage message) { |
687 switch (message.header.type) { | 686 switch (message.header.type) { |
688 case _urlResponseDiskCacheMethodGetName: | 687 case _urlResponseDiskCacheMethodGetName: |
689 var r = UrlResponseDiskCacheGetResponseParams.deserialize( | 688 var r = UrlResponseDiskCacheGetResponseParams.deserialize( |
690 message.payload); | 689 message.payload); |
691 if (!message.header.hasRequestId) { | 690 if (!message.header.hasRequestId) { |
692 proxyError("Expected a message with a valid request Id."); | 691 proxyError("Expected a message with a valid request Id."); |
693 return; | 692 return; |
694 } | 693 } |
695 Completer c = completerMap[message.header.requestId]; | 694 Completer c = completerMap[message.header.requestId]; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 } | 751 } |
753 } | 752 } |
754 | 753 |
755 @override | 754 @override |
756 String toString() { | 755 String toString() { |
757 var superString = super.toString(); | 756 var superString = super.toString(); |
758 return "_UrlResponseDiskCacheProxyControl($superString)"; | 757 return "_UrlResponseDiskCacheProxyControl($superString)"; |
759 } | 758 } |
760 } | 759 } |
761 | 760 |
762 | 761 class UrlResponseDiskCacheProxy |
763 class UrlResponseDiskCacheProxy extends bindings.Proxy | 762 extends bindings.Proxy |
764 implements UrlResponseDiskCache { | 763 implements UrlResponseDiskCache { |
765 UrlResponseDiskCacheProxy.fromEndpoint( | 764 UrlResponseDiskCacheProxy.fromEndpoint( |
766 core.MojoMessagePipeEndpoint endpoint) | 765 core.MojoMessagePipeEndpoint endpoint) |
767 : super(new _UrlResponseDiskCacheProxyControl.fromEndpoint(endpoint)); | 766 : super(new _UrlResponseDiskCacheProxyControl.fromEndpoint(endpoint)); |
768 | 767 |
769 UrlResponseDiskCacheProxy.fromHandle(core.MojoHandle handle) | 768 UrlResponseDiskCacheProxy.fromHandle(core.MojoHandle handle) |
770 : super(new _UrlResponseDiskCacheProxyControl.fromHandle(handle)); | 769 : super(new _UrlResponseDiskCacheProxyControl.fromHandle(handle)); |
771 | 770 |
772 UrlResponseDiskCacheProxy.unbound() | 771 UrlResponseDiskCacheProxy.unbound() |
773 : super(new _UrlResponseDiskCacheProxyControl.unbound()); | 772 : super(new _UrlResponseDiskCacheProxyControl.unbound()); |
774 | 773 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 var params = new _UrlResponseDiskCacheUpdateAndGetExtractedParams(); | 827 var params = new _UrlResponseDiskCacheUpdateAndGetExtractedParams(); |
829 params.response = response; | 828 params.response = response; |
830 return ctrl.sendMessageWithRequestId( | 829 return ctrl.sendMessageWithRequestId( |
831 params, | 830 params, |
832 _urlResponseDiskCacheMethodUpdateAndGetExtractedName, | 831 _urlResponseDiskCacheMethodUpdateAndGetExtractedName, |
833 -1, | 832 -1, |
834 bindings.MessageHeader.kMessageExpectsResponse); | 833 bindings.MessageHeader.kMessageExpectsResponse); |
835 } | 834 } |
836 } | 835 } |
837 | 836 |
838 | 837 class _UrlResponseDiskCacheStubControl |
839 class UrlResponseDiskCacheStub extends bindings.Stub { | 838 extends bindings.StubMessageHandler |
| 839 implements bindings.StubControl<UrlResponseDiskCache> { |
840 UrlResponseDiskCache _impl; | 840 UrlResponseDiskCache _impl; |
841 | 841 |
842 UrlResponseDiskCacheStub.fromEndpoint( | 842 _UrlResponseDiskCacheStubControl.fromEndpoint( |
843 core.MojoMessagePipeEndpoint endpoint, [UrlResponseDiskCache impl]) | 843 core.MojoMessagePipeEndpoint endpoint, [UrlResponseDiskCache impl]) |
844 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 844 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
845 _impl = impl; | 845 _impl = impl; |
846 } | 846 } |
847 | 847 |
848 UrlResponseDiskCacheStub.fromHandle( | 848 _UrlResponseDiskCacheStubControl.fromHandle( |
849 core.MojoHandle handle, [UrlResponseDiskCache impl]) | 849 core.MojoHandle handle, [UrlResponseDiskCache impl]) |
850 : super.fromHandle(handle, autoBegin: impl != null) { | 850 : super.fromHandle(handle, autoBegin: impl != null) { |
851 _impl = impl; | 851 _impl = impl; |
852 } | 852 } |
853 | 853 |
854 UrlResponseDiskCacheStub.unbound([this._impl]) : super.unbound(); | 854 _UrlResponseDiskCacheStubControl.unbound([this._impl]) : super.unbound(); |
855 | |
856 static UrlResponseDiskCacheStub newFromEndpoint( | |
857 core.MojoMessagePipeEndpoint endpoint) { | |
858 assert(endpoint.setDescription("For UrlResponseDiskCacheStub")); | |
859 return new UrlResponseDiskCacheStub.fromEndpoint(endpoint); | |
860 } | |
861 | 855 |
862 | 856 |
863 UrlResponseDiskCacheGetResponseParams _urlResponseDiskCacheGetResponseParamsFa
ctory(url_response_mojom.UrlResponse response, List<int> filePath, List<int> cac
heDirPath) { | 857 UrlResponseDiskCacheGetResponseParams _urlResponseDiskCacheGetResponseParamsFa
ctory(url_response_mojom.UrlResponse response, List<int> filePath, List<int> cac
heDirPath) { |
864 var result = new UrlResponseDiskCacheGetResponseParams(); | 858 var result = new UrlResponseDiskCacheGetResponseParams(); |
865 result.response = response; | 859 result.response = response; |
866 result.filePath = filePath; | 860 result.filePath = filePath; |
867 result.cacheDirPath = cacheDirPath; | 861 result.cacheDirPath = cacheDirPath; |
868 return result; | 862 return result; |
869 } | 863 } |
870 UrlResponseDiskCacheUpdateAndGetResponseParams _urlResponseDiskCacheUpdateAndG
etResponseParamsFactory(List<int> filePath, List<int> cacheDirPath) { | 864 UrlResponseDiskCacheUpdateAndGetResponseParams _urlResponseDiskCacheUpdateAndG
etResponseParamsFactory(List<int> filePath, List<int> cacheDirPath) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 } | 979 } |
986 | 980 |
987 @override | 981 @override |
988 void bind(core.MojoMessagePipeEndpoint endpoint) { | 982 void bind(core.MojoMessagePipeEndpoint endpoint) { |
989 super.bind(endpoint); | 983 super.bind(endpoint); |
990 if (!isOpen && (_impl != null)) { | 984 if (!isOpen && (_impl != null)) { |
991 beginHandlingEvents(); | 985 beginHandlingEvents(); |
992 } | 986 } |
993 } | 987 } |
994 | 988 |
| 989 @override |
995 String toString() { | 990 String toString() { |
996 var superString = super.toString(); | 991 var superString = super.toString(); |
997 return "UrlResponseDiskCacheStub($superString)"; | 992 return "_UrlResponseDiskCacheStubControl($superString)"; |
998 } | 993 } |
999 | 994 |
1000 int get version => 0; | 995 int get version => 0; |
1001 | 996 |
1002 static service_describer.ServiceDescription _cachedServiceDescription; | 997 static service_describer.ServiceDescription _cachedServiceDescription; |
1003 static service_describer.ServiceDescription get serviceDescription { | 998 static service_describer.ServiceDescription get serviceDescription { |
1004 if (_cachedServiceDescription == null) { | 999 if (_cachedServiceDescription == null) { |
1005 _cachedServiceDescription = new _UrlResponseDiskCacheServiceDescription(); | 1000 _cachedServiceDescription = new _UrlResponseDiskCacheServiceDescription(); |
1006 } | 1001 } |
1007 return _cachedServiceDescription; | 1002 return _cachedServiceDescription; |
1008 } | 1003 } |
1009 } | 1004 } |
1010 | 1005 |
| 1006 class UrlResponseDiskCacheStub |
| 1007 extends bindings.Stub<UrlResponseDiskCache> |
| 1008 implements UrlResponseDiskCache { |
| 1009 UrlResponseDiskCacheStub.fromEndpoint( |
| 1010 core.MojoMessagePipeEndpoint endpoint, [UrlResponseDiskCache impl]) |
| 1011 : super(new _UrlResponseDiskCacheStubControl.fromEndpoint(endpoint, impl))
; |
| 1012 |
| 1013 UrlResponseDiskCacheStub.fromHandle( |
| 1014 core.MojoHandle handle, [UrlResponseDiskCache impl]) |
| 1015 : super(new _UrlResponseDiskCacheStubControl.fromHandle(handle, impl)); |
| 1016 |
| 1017 UrlResponseDiskCacheStub.unbound([UrlResponseDiskCache impl]) |
| 1018 : super(new _UrlResponseDiskCacheStubControl.unbound(impl)); |
| 1019 |
| 1020 static UrlResponseDiskCacheStub newFromEndpoint( |
| 1021 core.MojoMessagePipeEndpoint endpoint) { |
| 1022 assert(endpoint.setDescription("For UrlResponseDiskCacheStub")); |
| 1023 return new UrlResponseDiskCacheStub.fromEndpoint(endpoint); |
| 1024 } |
| 1025 |
| 1026 static service_describer.ServiceDescription get serviceDescription => |
| 1027 _UrlResponseDiskCacheStubControl.serviceDescription; |
| 1028 |
| 1029 |
| 1030 dynamic get(String url,[Function responseFactory = null]) { |
| 1031 return impl.get(url,responseFactory); |
| 1032 } |
| 1033 void validate(String url) { |
| 1034 return impl.validate(url); |
| 1035 } |
| 1036 void update(url_response_mojom.UrlResponse response) { |
| 1037 return impl.update(response); |
| 1038 } |
| 1039 dynamic updateAndGet(url_response_mojom.UrlResponse response,[Function respons
eFactory = null]) { |
| 1040 return impl.updateAndGet(response,responseFactory); |
| 1041 } |
| 1042 dynamic updateAndGetExtracted(url_response_mojom.UrlResponse response,[Functio
n responseFactory = null]) { |
| 1043 return impl.updateAndGetExtracted(response,responseFactory); |
| 1044 } |
| 1045 } |
| 1046 |
1011 | 1047 |
1012 | 1048 |
OLD | NEW |