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 #include "mojo/services/network/url_loader_impl.h" | 5 #include "mojo/services/network/url_loader_impl.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "mojo/common/common_type_converters.h" | 8 #include "mojo/common/common_type_converters.h" |
9 #include "mojo/services/network/network_context.h" | 9 #include "mojo/services/network/network_context.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 URLLoaderImpl::URLLoaderImpl(NetworkContext* context) | 111 URLLoaderImpl::URLLoaderImpl(NetworkContext* context) |
112 : context_(context), | 112 : context_(context), |
113 response_body_buffer_size_(0), | 113 response_body_buffer_size_(0), |
114 auto_follow_redirects_(true), | 114 auto_follow_redirects_(true), |
115 weak_ptr_factory_(this) { | 115 weak_ptr_factory_(this) { |
116 } | 116 } |
117 | 117 |
118 URLLoaderImpl::~URLLoaderImpl() { | 118 URLLoaderImpl::~URLLoaderImpl() { |
119 } | 119 } |
120 | 120 |
121 void URLLoaderImpl::OnConnectionError() { | |
122 delete this; | |
123 } | |
124 | |
125 void URLLoaderImpl::Start(URLRequestPtr request, | 121 void URLLoaderImpl::Start(URLRequestPtr request, |
126 const Callback<void(URLResponsePtr)>& callback) { | 122 const Callback<void(URLResponsePtr)>& callback) { |
127 if (url_request_) { | 123 if (url_request_) { |
128 SendError(net::ERR_UNEXPECTED, callback); | 124 SendError(net::ERR_UNEXPECTED, callback); |
129 return; | 125 return; |
130 } | 126 } |
131 | 127 |
132 if (!request) { | 128 if (!request) { |
133 SendError(net::ERR_INVALID_ARGUMENT, callback); | 129 SendError(net::ERR_INVALID_ARGUMENT, callback); |
134 return; | 130 return; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 if (completed_synchronously) { | 318 if (completed_synchronously) { |
323 base::MessageLoop::current()->PostTask( | 319 base::MessageLoop::current()->PostTask( |
324 FROM_HERE, | 320 FROM_HERE, |
325 base::Bind(&URLLoaderImpl::ReadMore, weak_ptr_factory_.GetWeakPtr())); | 321 base::Bind(&URLLoaderImpl::ReadMore, weak_ptr_factory_.GetWeakPtr())); |
326 } else { | 322 } else { |
327 ReadMore(); | 323 ReadMore(); |
328 } | 324 } |
329 } | 325 } |
330 | 326 |
331 } // namespace mojo | 327 } // namespace mojo |
OLD | NEW |