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

Side by Side Diff: sky/framework/xmlhttprequest.sky

Issue 696373003: Don't GC message pipes that have an in-flight request (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/examples/file-browser.sky ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <import src="/mojo/public/sky/core.sky" as="core" /> 1 <import src="/mojo/public/sky/core.sky" as="core" />
2 <import src="/mojo/public/sky/unicode.sky" as="unicode" /> 2 <import src="/mojo/public/sky/unicode.sky" as="unicode" />
3 <import src="/mojo/services/public/interfaces/network/network_service.mojom.sky" as="net" /> 3 <import src="/mojo/services/public/interfaces/network/network_service.mojom.sky" as="net" />
4 <import src="/mojo/services/public/interfaces/network/url_loader.mojom.sky" as=" loader" /> 4 <import src="/mojo/services/public/interfaces/network/url_loader.mojom.sky" as=" loader" />
5 <import src="shell.sky" as="shell" /> 5 <import src="shell.sky" as="shell" />
6 <script> 6 <script>
7 function XMLHttpRequest() { 7 function XMLHttpRequest() {
8 this.networkService_ = shell.connectToService( 8 this.networkService_ = shell.connectToService(
9 "mojo://network_service/", net.NetworkService); 9 "mojo://network_service/", net.NetworkService);
10 this.request_ = null; 10 this.request_ = null;
(...skipping 24 matching lines...) Expand all
35 }); 35 });
36 this.request_.headers = requestHeaders; 36 this.request_.headers = requestHeaders;
37 37
38 // FIXME: Factor this into the JS bindings. 38 // FIXME: Factor this into the JS bindings.
39 var pipe = new core.createMessagePipe(); 39 var pipe = new core.createMessagePipe();
40 this.networkService_.createURLLoader(pipe.handle1); 40 this.networkService_.createURLLoader(pipe.handle1);
41 this.loader_ = shell.wrapHandle(pipe.handle0, loader.URLLoader); 41 this.loader_ = shell.wrapHandle(pipe.handle0, loader.URLLoader);
42 42
43 var self = this; 43 var self = this;
44 this.loader_.start(this.request_).then(function(result) { 44 this.loader_.start(this.request_).then(function(result) {
45 core.drainData(result.response.body).then(function(result) { 45 return core.drainData(result.response.body).then(function(result) {
46 self.responseText = unicode.decodeUtf8String(new Uint8Array(result.buffer) ); 46 self.responseText = unicode.decodeUtf8String(new Uint8Array(result.buffer) );
47 self.onload(); 47 self.onload();
48 }).catch(function(error) {
49 self.onerror(error);
50 }); 48 });
51 }).catch(function(error) { 49 }).catch(function(error) {
52 self.onerror(error); 50 self.onerror(error);
53 }); 51 });
54 }; 52 };
55 53
56 module.exports = XMLHttpRequest; 54 module.exports = XMLHttpRequest;
57 </script> 55 </script>
OLDNEW
« no previous file with comments | « sky/examples/file-browser.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698