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/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "mojo/common/common_type_converters.h" | 9 #include "mojo/common/common_type_converters.h" |
10 #include "mojo/common/url_type_converters.h" | 10 #include "mojo/common/url_type_converters.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 DISALLOW_COPY_AND_ASSIGN(UploadDataPipeElementReader); | 130 DISALLOW_COPY_AND_ASSIGN(UploadDataPipeElementReader); |
131 }; | 131 }; |
132 | 132 |
133 } // namespace | 133 } // namespace |
134 | 134 |
135 URLLoaderImpl::URLLoaderImpl(NetworkContext* context, | 135 URLLoaderImpl::URLLoaderImpl(NetworkContext* context, |
136 InterfaceRequest<URLLoader> request, | 136 InterfaceRequest<URLLoader> request, |
137 scoped_ptr<mojo::AppRefCount> app_refcount) | 137 scoped_ptr<mojo::AppRefCount> app_refcount) |
138 : context_(context), | 138 : context_(context), |
| 139 handle_watcher_(12), |
139 response_body_buffer_size_(0), | 140 response_body_buffer_size_(0), |
140 auto_follow_redirects_(true), | 141 auto_follow_redirects_(true), |
141 connected_(true), | 142 connected_(true), |
142 binding_(this, request.Pass()), | 143 binding_(this, request.Pass()), |
143 app_refcount_(app_refcount.Pass()), | 144 app_refcount_(app_refcount.Pass()), |
144 weak_ptr_factory_(this) { | 145 weak_ptr_factory_(this) { |
145 binding_.set_connection_error_handler([this]() { OnConnectionError(); }); | 146 binding_.set_connection_error_handler([this]() { OnConnectionError(); }); |
146 context_->RegisterURLLoader(this); | 147 context_->RegisterURLLoader(this); |
147 } | 148 } |
148 | 149 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 404 |
404 void URLLoaderImpl::ListenForPeerClosed() { | 405 void URLLoaderImpl::ListenForPeerClosed() { |
405 handle_watcher_.Start(response_body_stream_.get(), | 406 handle_watcher_.Start(response_body_stream_.get(), |
406 MOJO_HANDLE_SIGNAL_PEER_CLOSED, | 407 MOJO_HANDLE_SIGNAL_PEER_CLOSED, |
407 MOJO_DEADLINE_INDEFINITE, | 408 MOJO_DEADLINE_INDEFINITE, |
408 base::Bind(&URLLoaderImpl::OnResponseBodyStreamClosed, | 409 base::Bind(&URLLoaderImpl::OnResponseBodyStreamClosed, |
409 base::Unretained(this))); | 410 base::Unretained(this))); |
410 } | 411 } |
411 | 412 |
412 } // namespace mojo | 413 } // namespace mojo |
OLD | NEW |