| 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 #include "content/browser/renderer_host/resource_loader.h" | 5 #include "content/browser/renderer_host/resource_loader.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
| 10 #include "content/browser/renderer_host/doomed_resource_handler.h" | 10 #include "content/browser/renderer_host/doomed_resource_handler.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // When an URLRequest is transferred to a new RenderViewHost, its | 140 // When an URLRequest is transferred to a new RenderViewHost, its |
| 141 // ResourceHandler should not receive any notifications because it may depend | 141 // ResourceHandler should not receive any notifications because it may depend |
| 142 // on the state of the old RVH. We set a ResourceHandler that only allows | 142 // on the state of the old RVH. We set a ResourceHandler that only allows |
| 143 // canceling requests, because on shutdown of the RDH all pending requests | 143 // canceling requests, because on shutdown of the RDH all pending requests |
| 144 // are canceled. The RVH of requests that are being transferred may be gone | 144 // are canceled. The RVH of requests that are being transferred may be gone |
| 145 // by that time. In CompleteTransfer, the ResoureHandlers are substituted | 145 // by that time. In CompleteTransfer, the ResoureHandlers are substituted |
| 146 // again. | 146 // again. |
| 147 handler_.reset(new DoomedResourceHandler(handler_.Pass())); | 147 handler_.reset(new DoomedResourceHandler(handler_.Pass())); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void ResourceLoader::WillCompleteTransfer() { |
| 151 handler_.reset(); |
| 152 } |
| 153 |
| 150 void ResourceLoader::CompleteTransfer(scoped_ptr<ResourceHandler> new_handler) { | 154 void ResourceLoader::CompleteTransfer(scoped_ptr<ResourceHandler> new_handler) { |
| 151 DCHECK_EQ(DEFERRED_REDIRECT, deferred_stage_); | 155 DCHECK_EQ(DEFERRED_REDIRECT, deferred_stage_); |
| 156 DCHECK(!handler_.get()); |
| 152 | 157 |
| 153 handler_ = new_handler.Pass(); | 158 handler_ = new_handler.Pass(); |
| 154 handler_->SetController(this); | 159 handler_->SetController(this); |
| 155 is_transferring_ = false; | 160 is_transferring_ = false; |
| 156 | 161 |
| 157 Resume(); | 162 Resume(); |
| 158 } | 163 } |
| 159 | 164 |
| 160 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() { | 165 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() { |
| 161 return ResourceRequestInfoImpl::ForRequest(request_.get()); | 166 return ResourceRequestInfoImpl::ForRequest(request_.get()); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // we resume. | 557 // we resume. |
| 553 deferred_stage_ = DEFERRED_FINISH; | 558 deferred_stage_ = DEFERRED_FINISH; |
| 554 } | 559 } |
| 555 } | 560 } |
| 556 | 561 |
| 557 void ResourceLoader::CallDidFinishLoading() { | 562 void ResourceLoader::CallDidFinishLoading() { |
| 558 delegate_->DidFinishLoading(this); | 563 delegate_->DidFinishLoading(this); |
| 559 } | 564 } |
| 560 | 565 |
| 561 } // namespace content | 566 } // namespace content |
| OLD | NEW |