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

Side by Side Diff: content/browser/loader/navigation_resource_handler.cc

Issue 2668603003: Make ResourceHandler::OnWillRead able to complete asynchronously. (Closed)
Patch Set: Response to comments Created 3 years, 9 months 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 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 "content/browser/loader/navigation_resource_handler.h" 5 #include "content/browser/loader/navigation_resource_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 147 }
148 } 148 }
149 149
150 void NavigationResourceHandler::OnWillStart( 150 void NavigationResourceHandler::OnWillStart(
151 const GURL& url, 151 const GURL& url,
152 std::unique_ptr<ResourceController> controller) { 152 std::unique_ptr<ResourceController> controller) {
153 DCHECK(!has_controller()); 153 DCHECK(!has_controller());
154 controller->Resume(); 154 controller->Resume();
155 } 155 }
156 156
157 bool NavigationResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, 157 void NavigationResourceHandler::OnWillRead(
158 int* buf_size) { 158 scoped_refptr<net::IOBuffer>* buf,
159 int* buf_size,
160 std::unique_ptr<ResourceController> controller) {
159 DCHECK(!has_controller()); 161 DCHECK(!has_controller());
160 writer_.OnWillRead(buf, buf_size, -1); 162 writer_.OnWillRead(buf, buf_size, -1);
161 return true; 163 controller->Resume();
162 } 164 }
163 165
164 void NavigationResourceHandler::OnReadCompleted( 166 void NavigationResourceHandler::OnReadCompleted(
165 int bytes_read, 167 int bytes_read,
166 std::unique_ptr<ResourceController> controller) { 168 std::unique_ptr<ResourceController> controller) {
167 DCHECK(!has_controller()); 169 DCHECK(!has_controller());
168 writer_.OnReadCompleted(bytes_read, 170 writer_.OnReadCompleted(bytes_read,
169 base::Bind(&ResourceController::Resume, 171 base::Bind(&ResourceController::Resume,
170 base::Passed(std::move(controller)))); 172 base::Passed(std::move(controller))));
171 } 173 }
(...skipping 21 matching lines...) Expand all
193 NOTREACHED(); 195 NOTREACHED();
194 } 196 }
195 197
196 void NavigationResourceHandler::DetachFromCore() { 198 void NavigationResourceHandler::DetachFromCore() {
197 DCHECK(core_); 199 DCHECK(core_);
198 core_->set_resource_handler(nullptr); 200 core_->set_resource_handler(nullptr);
199 core_ = nullptr; 201 core_ = nullptr;
200 } 202 }
201 203
202 } // namespace content 204 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_resource_handler.h ('k') | content/browser/loader/redirect_to_file_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698