| 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 "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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool NavigationResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 158 int* buf_size, | 158 int* buf_size) { |
| 159 int min_size) { | |
| 160 DCHECK(!has_controller()); | 159 DCHECK(!has_controller()); |
| 161 writer_.OnWillRead(buf, buf_size, min_size); | 160 writer_.OnWillRead(buf, buf_size, -1); |
| 162 return true; | 161 return true; |
| 163 } | 162 } |
| 164 | 163 |
| 165 void NavigationResourceHandler::OnReadCompleted( | 164 void NavigationResourceHandler::OnReadCompleted( |
| 166 int bytes_read, | 165 int bytes_read, |
| 167 std::unique_ptr<ResourceController> controller) { | 166 std::unique_ptr<ResourceController> controller) { |
| 168 DCHECK(!has_controller()); | 167 DCHECK(!has_controller()); |
| 169 writer_.OnReadCompleted(bytes_read, | 168 writer_.OnReadCompleted(bytes_read, |
| 170 base::Bind(&ResourceController::Resume, | 169 base::Bind(&ResourceController::Resume, |
| 171 base::Passed(std::move(controller)))); | 170 base::Passed(std::move(controller)))); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 194 NOTREACHED(); | 193 NOTREACHED(); |
| 195 } | 194 } |
| 196 | 195 |
| 197 void NavigationResourceHandler::DetachFromCore() { | 196 void NavigationResourceHandler::DetachFromCore() { |
| 198 DCHECK(core_); | 197 DCHECK(core_); |
| 199 core_->set_resource_handler(nullptr); | 198 core_->set_resource_handler(nullptr); |
| 200 core_ = nullptr; | 199 core_ = nullptr; |
| 201 } | 200 } |
| 202 | 201 |
| 203 } // namespace content | 202 } // namespace content |
| OLD | NEW |