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

Side by Side Diff: content/child/resource_dispatcher.cc

Issue 2561743003: Use associated interface on DownloadedTempFile (Closed)
Patch Set: update LayoutTest/TestExpectations Created 4 years 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
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 request_id_(request_id), 85 request_id_(request_id),
86 resource_dispatcher_(resource_dispatcher), 86 resource_dispatcher_(resource_dispatcher),
87 task_runner_(std::move(task_runner)) {} 87 task_runner_(std::move(task_runner)) {}
88 ~URLLoaderClientImpl() override { 88 ~URLLoaderClientImpl() override {
89 if (body_consumer_) 89 if (body_consumer_)
90 body_consumer_->Cancel(); 90 body_consumer_->Cancel();
91 } 91 }
92 92
93 void OnReceiveResponse( 93 void OnReceiveResponse(
94 const ResourceResponseHead& response_head, 94 const ResourceResponseHead& response_head,
95 mojom::DownloadedTempFilePtr downloaded_file) override { 95 mojom::DownloadedTempFileAssociatedPtrInfo downloaded_file) override {
96 has_received_response_ = true; 96 has_received_response_ = true;
97 if (body_consumer_) 97 if (body_consumer_)
98 body_consumer_->Start(task_runner_.get()); 98 body_consumer_->Start(task_runner_.get());
99 downloaded_file_ = std::move(downloaded_file); 99 downloaded_file_.Bind(std::move(downloaded_file));
100 resource_dispatcher_->OnMessageReceived( 100 resource_dispatcher_->OnMessageReceived(
101 ResourceMsg_ReceivedResponse(request_id_, response_head)); 101 ResourceMsg_ReceivedResponse(request_id_, response_head));
102 } 102 }
103 103
104 void OnReceiveRedirect(const net::RedirectInfo& redirect_info, 104 void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
105 const ResourceResponseHead& response_head) override { 105 const ResourceResponseHead& response_head) override {
106 DCHECK(!has_received_response_); 106 DCHECK(!has_received_response_);
107 DCHECK(!body_consumer_); 107 DCHECK(!body_consumer_);
108 resource_dispatcher_->OnMessageReceived(ResourceMsg_ReceivedRedirect( 108 resource_dispatcher_->OnMessageReceived(ResourceMsg_ReceivedRedirect(
109 request_id_, redirect_info, response_head)); 109 request_id_, redirect_info, response_head));
(...skipping 23 matching lines...) Expand all
133 } 133 }
134 134
135 void Bind(mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info, 135 void Bind(mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info,
136 mojo::AssociatedGroup* associated_group) { 136 mojo::AssociatedGroup* associated_group) {
137 binding_.Bind(client_ptr_info, associated_group); 137 binding_.Bind(client_ptr_info, associated_group);
138 } 138 }
139 139
140 private: 140 private:
141 mojo::AssociatedBinding<mojom::URLLoaderClient> binding_; 141 mojo::AssociatedBinding<mojom::URLLoaderClient> binding_;
142 scoped_refptr<URLResponseBodyConsumer> body_consumer_; 142 scoped_refptr<URLResponseBodyConsumer> body_consumer_;
143 mojom::DownloadedTempFilePtr downloaded_file_; 143 mojom::DownloadedTempFileAssociatedPtr downloaded_file_;
144 const int request_id_; 144 const int request_id_;
145 bool has_received_response_ = false; 145 bool has_received_response_ = false;
146 ResourceDispatcher* const resource_dispatcher_; 146 ResourceDispatcher* const resource_dispatcher_;
147 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 147 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
148 }; 148 };
149 149
150 void CheckSchemeForReferrerPolicy(const ResourceRequest& request) { 150 void CheckSchemeForReferrerPolicy(const ResourceRequest& request) {
151 if ((request.referrer_policy == blink::WebReferrerPolicyDefault || 151 if ((request.referrer_policy == blink::WebReferrerPolicyDefault ||
152 request.referrer_policy == 152 request.referrer_policy ==
153 blink::WebReferrerPolicyNoReferrerWhenDowngrade) && 153 blink::WebReferrerPolicyNoReferrerWhenDowngrade) &&
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 delete message; 852 delete message;
853 } 853 }
854 } 854 }
855 855
856 void ResourceDispatcher::SetResourceSchedulingFilter( 856 void ResourceDispatcher::SetResourceSchedulingFilter(
857 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { 857 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) {
858 resource_scheduling_filter_ = resource_scheduling_filter; 858 resource_scheduling_filter_ = resource_scheduling_filter;
859 } 859 }
860 860
861 } // namespace content 861 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698