| 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 "chrome/browser/prerender/prerender_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 base::Bind(&OnCloseWebContentsDeleter::ScheduleWebContentsForDeletion, | 137 base::Bind(&OnCloseWebContentsDeleter::ScheduleWebContentsForDeletion, |
| 138 AsWeakPtr(), true), | 138 AsWeakPtr(), true), |
| 139 base::TimeDelta::FromSeconds(kDeleteWithExtremePrejudiceSeconds)); | 139 base::TimeDelta::FromSeconds(kDeleteWithExtremePrejudiceSeconds)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void CloseContents(WebContents* source) override { | 142 void CloseContents(WebContents* source) override { |
| 143 DCHECK_EQ(tab_.get(), source); | 143 DCHECK_EQ(tab_.get(), source); |
| 144 ScheduleWebContentsForDeletion(false); | 144 ScheduleWebContentsForDeletion(false); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void SwappedOut(WebContents* source) override { | |
| 148 DCHECK_EQ(tab_.get(), source); | |
| 149 ScheduleWebContentsForDeletion(false); | |
| 150 } | |
| 151 | |
| 152 bool ShouldSuppressDialogs(WebContents* source) override { | 147 bool ShouldSuppressDialogs(WebContents* source) override { |
| 153 // Use this as a proxy for getting statistics on how often we fail to honor | 148 // Use this as a proxy for getting statistics on how often we fail to honor |
| 154 // the beforeunload event. | 149 // the beforeunload event. |
| 155 DCHECK_EQ(tab_.get(), source); | 150 DCHECK_EQ(tab_.get(), source); |
| 156 suppressed_dialog_ = true; | 151 suppressed_dialog_ = true; |
| 157 return true; | 152 return true; |
| 158 } | 153 } |
| 159 | 154 |
| 160 private: | 155 private: |
| 161 static const int kDeleteWithExtremePrejudiceSeconds = 3; | 156 static const int kDeleteWithExtremePrejudiceSeconds = 3; |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 } | 1355 } |
| 1361 | 1356 |
| 1362 void PrerenderManager::RenderProcessHostDestroyed( | 1357 void PrerenderManager::RenderProcessHostDestroyed( |
| 1363 content::RenderProcessHost* host) { | 1358 content::RenderProcessHost* host) { |
| 1364 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1359 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1365 size_t erased = prerender_process_hosts_.erase(host); | 1360 size_t erased = prerender_process_hosts_.erase(host); |
| 1366 DCHECK_EQ(1u, erased); | 1361 DCHECK_EQ(1u, erased); |
| 1367 } | 1362 } |
| 1368 | 1363 |
| 1369 } // namespace prerender | 1364 } // namespace prerender |
| OLD | NEW |