| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 void CloseContents(WebContents* source) override { | 184 void CloseContents(WebContents* source) override { |
| 185 DCHECK_EQ(tab_, source); | 185 DCHECK_EQ(tab_, source); |
| 186 ScheduleWebContentsForDeletion(false); | 186 ScheduleWebContentsForDeletion(false); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void SwappedOut(WebContents* source) override { | 189 void SwappedOut(WebContents* source) override { |
| 190 DCHECK_EQ(tab_, source); | 190 DCHECK_EQ(tab_, source); |
| 191 ScheduleWebContentsForDeletion(false); | 191 ScheduleWebContentsForDeletion(false); |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool ShouldSuppressDialogs() override { | 194 bool ShouldSuppressDialogs(WebContents* source) override { |
| 195 // Use this as a proxy for getting statistics on how often we fail to honor | 195 // Use this as a proxy for getting statistics on how often we fail to honor |
| 196 // the beforeunload event. | 196 // the beforeunload event. |
| 197 DCHECK_EQ(tab_, source); |
| 197 suppressed_dialog_ = true; | 198 suppressed_dialog_ = true; |
| 198 return true; | 199 return true; |
| 199 } | 200 } |
| 200 | 201 |
| 201 private: | 202 private: |
| 202 static const int kDeleteWithExtremePrejudiceSeconds = 3; | 203 static const int kDeleteWithExtremePrejudiceSeconds = 3; |
| 203 | 204 |
| 204 void ScheduleWebContentsForDeletion(bool timeout) { | 205 void ScheduleWebContentsForDeletion(bool timeout) { |
| 205 UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterTimeout", timeout); | 206 UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterTimeout", timeout); |
| 206 UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterSuppressedDialog", | 207 UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterSuppressedDialog", |
| (...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 content::RenderProcessHost* host) { | 1898 content::RenderProcessHost* host) { |
| 1898 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1899 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1899 prerender_process_hosts_.erase(host); | 1900 prerender_process_hosts_.erase(host); |
| 1900 BrowserThread::PostTask( | 1901 BrowserThread::PostTask( |
| 1901 BrowserThread::IO, FROM_HERE, | 1902 BrowserThread::IO, FROM_HERE, |
| 1902 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, | 1903 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, |
| 1903 base::Unretained(prerender_tracker()), host->GetID(), false)); | 1904 base::Unretained(prerender_tracker()), host->GetID(), false)); |
| 1904 } | 1905 } |
| 1905 | 1906 |
| 1906 } // namespace prerender | 1907 } // namespace prerender |
| OLD | NEW |