| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 URLResponsePtr response = MakeURLResponse(url_request); | 383 URLResponsePtr response = MakeURLResponse(url_request); |
| 384 response->body = data_pipe.consumer_handle.Pass(); | 384 response->body = data_pipe.consumer_handle.Pass(); |
| 385 | 385 |
| 386 // Build the body fetcher. | 386 // Build the body fetcher. |
| 387 std::unique_ptr<BodyFetcher> body_fetcher( | 387 std::unique_ptr<BodyFetcher> body_fetcher( |
| 388 new BodyFetcher(this, ++current_fetcher_id_, url_request_.Pass(), | 388 new BodyFetcher(this, ++current_fetcher_id_, url_request_.Pass(), |
| 389 data_pipe.producer_handle.Pass())); | 389 data_pipe.producer_handle.Pass())); |
| 390 | 390 |
| 391 SendResponse(response.Pass()); | 391 SendResponse(response.Pass()); |
| 392 body_fetcher->Start(); | |
| 393 body_fetchers_.push_back(std::move(body_fetcher)); | 392 body_fetchers_.push_back(std::move(body_fetcher)); |
| 393 body_fetchers_.back()->Start(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 void URLLoaderImpl::OnReadCompleted(net::URLRequest* url_request, | 396 void URLLoaderImpl::OnReadCompleted(net::URLRequest* url_request, |
| 397 int bytes_read) { | 397 int bytes_read) { |
| 398 // This should never be called on this object. | 398 // This should never be called on this object. |
| 399 DCHECK(false); | 399 DCHECK(false); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void URLLoaderImpl::SendError( | 402 void URLLoaderImpl::SendError( |
| 403 int error_code, | 403 int error_code, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 if ((*it)->id() == current_fetcher_id_) { | 559 if ((*it)->id() == current_fetcher_id_) { |
| 560 last_status_ = fetcher->QueryStatus(); | 560 last_status_ = fetcher->QueryStatus(); |
| 561 last_status_->is_loading = false; | 561 last_status_->is_loading = false; |
| 562 } | 562 } |
| 563 body_fetchers_.erase(it); | 563 body_fetchers_.erase(it); |
| 564 if (body_fetchers_.empty() and !binding_.is_bound()) | 564 if (body_fetchers_.empty() and !binding_.is_bound()) |
| 565 delete this; | 565 delete this; |
| 566 } | 566 } |
| 567 | 567 |
| 568 } // namespace mojo | 568 } // namespace mojo |
| OLD | NEW |