| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "content/child/resource_dispatcher.h" | 7 #include "content/child/resource_dispatcher.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 void OnStartLoadingResponseBody( | 96 void OnStartLoadingResponseBody( |
| 97 mojo::ScopedDataPipeConsumerHandle body) override { | 97 mojo::ScopedDataPipeConsumerHandle body) override { |
| 98 DCHECK(!body_consumer_); | 98 DCHECK(!body_consumer_); |
| 99 body_consumer_ = new URLResponseBodyConsumer( | 99 body_consumer_ = new URLResponseBodyConsumer( |
| 100 request_id_, resource_dispatcher_, std::move(body), task_runner_); | 100 request_id_, resource_dispatcher_, std::move(body), task_runner_); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void OnComplete(const ResourceRequestCompletionStatus& status) override { | 103 void OnComplete(const ResourceRequestCompletionStatus& status) override { |
| 104 if (!body_consumer_) { |
| 105 resource_dispatcher_->OnMessageReceived( |
| 106 ResourceMsg_RequestComplete(request_id_, status)); |
| 107 return; |
| 108 } |
| 104 body_consumer_->OnComplete(status); | 109 body_consumer_->OnComplete(status); |
| 105 } | 110 } |
| 106 | 111 |
| 107 mojom::URLLoaderClientPtr CreateInterfacePtrAndBind() { | 112 mojom::URLLoaderClientPtr CreateInterfacePtrAndBind() { |
| 108 return binding_.CreateInterfacePtrAndBind(); | 113 return binding_.CreateInterfacePtrAndBind(); |
| 109 } | 114 } |
| 110 | 115 |
| 111 private: | 116 private: |
| 112 mojo::Binding<mojom::URLLoaderClient> binding_; | 117 mojo::Binding<mojom::URLLoaderClient> binding_; |
| 113 scoped_refptr<URLResponseBodyConsumer> body_consumer_; | 118 scoped_refptr<URLResponseBodyConsumer> body_consumer_; |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 delete message; | 815 delete message; |
| 811 } | 816 } |
| 812 } | 817 } |
| 813 | 818 |
| 814 void ResourceDispatcher::SetResourceSchedulingFilter( | 819 void ResourceDispatcher::SetResourceSchedulingFilter( |
| 815 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 820 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
| 816 resource_scheduling_filter_ = resource_scheduling_filter; | 821 resource_scheduling_filter_ = resource_scheduling_filter; |
| 817 } | 822 } |
| 818 | 823 |
| 819 } // namespace content | 824 } // namespace content |
| OLD | NEW |