| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/prerender/prerender_pending_swap_throttle.h" | 5 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" |
| 6 | 6 |
| 7 #include "chrome/browser/prerender/prerender_final_status.h" | 7 #include "chrome/browser/prerender/prerender_final_status.h" |
| 8 #include "chrome/browser/prerender/prerender_manager.h" | 8 #include "chrome/browser/prerender/prerender_manager.h" |
| 9 #include "chrome/browser/prerender/prerender_tracker.h" | 9 #include "chrome/browser/prerender/prerender_tracker.h" |
| 10 #include "chrome/browser/prerender/prerender_util.h" | 10 #include "chrome/browser/prerender/prerender_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 tracker_(tracker), | 23 tracker_(tracker), |
| 24 throttled_(false) { | 24 throttled_(false) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 void PrerenderPendingSwapThrottle::WillStartRequest(bool* defer) { | 27 void PrerenderPendingSwapThrottle::WillStartRequest(bool* defer) { |
| 28 DCHECK(!throttled_); | 28 DCHECK(!throttled_); |
| 29 const content::ResourceRequestInfo* info = | 29 const content::ResourceRequestInfo* info = |
| 30 content::ResourceRequestInfo::ForRequest(request_); | 30 content::ResourceRequestInfo::ForRequest(request_); |
| 31 | 31 |
| 32 // We only care about main frame loads. | 32 // We only care about main frame loads. |
| 33 if (info->GetResourceType() != ResourceType::MAIN_FRAME) | 33 if (info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME) |
| 34 return; | 34 return; |
| 35 | 35 |
| 36 int render_process_id = info->GetChildID(); | 36 int render_process_id = info->GetChildID(); |
| 37 int render_frame_id = info->GetRenderFrameID(); | 37 int render_frame_id = info->GetRenderFrameID(); |
| 38 | 38 |
| 39 // Check if this request is for a URL we intend to swap in. | 39 // Check if this request is for a URL we intend to swap in. |
| 40 if (!tracker_->IsPendingSwapRequestOnIOThread( | 40 if (!tracker_->IsPendingSwapRequestOnIOThread( |
| 41 render_process_id, render_frame_id, request_->url())) { | 41 render_process_id, render_frame_id, request_->url())) { |
| 42 return; | 42 return; |
| 43 } | 43 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 void PrerenderPendingSwapThrottle::Cancel() { | 62 void PrerenderPendingSwapThrottle::Cancel() { |
| 63 DCHECK(throttled_); | 63 DCHECK(throttled_); |
| 64 | 64 |
| 65 throttled_ = false; | 65 throttled_ = false; |
| 66 controller()->Cancel(); | 66 controller()->Cancel(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace prerender | 69 } // namespace prerender |
| OLD | NEW |