| 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 void PrerenderManager::RecordFinalStatusWithoutCreatingPrerenderContents( | 1196 void PrerenderManager::RecordFinalStatusWithoutCreatingPrerenderContents( |
| 1197 const GURL& url, Origin origin, FinalStatus final_status) const { | 1197 const GURL& url, Origin origin, FinalStatus final_status) const { |
| 1198 PrerenderHistory::Entry entry(url, final_status, origin, base::Time::Now()); | 1198 PrerenderHistory::Entry entry(url, final_status, origin, base::Time::Now()); |
| 1199 prerender_history_->AddEntry(entry); | 1199 prerender_history_->AddEntry(entry); |
| 1200 histograms_->RecordFinalStatus(origin, final_status); | 1200 histograms_->RecordFinalStatus(origin, final_status); |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 void PrerenderManager::Observe(int type, | 1203 void PrerenderManager::Observe(int type, |
| 1204 const content::NotificationSource& source, | 1204 const content::NotificationSource& source, |
| 1205 const content::NotificationDetails& details) { | 1205 const content::NotificationDetails& details) { |
| 1206 switch (type) { | 1206 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
| 1207 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 1207 |
| 1208 DestroyAllContents(FINAL_STATUS_PROFILE_DESTROYED); | 1208 DestroyAllContents(FINAL_STATUS_PROFILE_DESTROYED); |
| 1209 on_close_web_contents_deleters_.clear(); | 1209 on_close_web_contents_deleters_.clear(); |
| 1210 break; | |
| 1211 default: | |
| 1212 NOTREACHED() << "Unexpected notification sent."; | |
| 1213 break; | |
| 1214 } | |
| 1215 } | 1210 } |
| 1216 | 1211 |
| 1217 void PrerenderManager::OnCreatingAudioStream(int render_process_id, | 1212 void PrerenderManager::OnCreatingAudioStream(int render_process_id, |
| 1218 int render_frame_id) { | 1213 int render_frame_id) { |
| 1219 content::RenderFrameHost* render_frame_host = | 1214 content::RenderFrameHost* render_frame_host = |
| 1220 content::RenderFrameHost::FromID(render_process_id, render_frame_id); | 1215 content::RenderFrameHost::FromID(render_process_id, render_frame_id); |
| 1221 WebContents* tab = WebContents::FromRenderFrameHost(render_frame_host); | 1216 WebContents* tab = WebContents::FromRenderFrameHost(render_frame_host); |
| 1222 if (!tab) | 1217 if (!tab) |
| 1223 return; | 1218 return; |
| 1224 | 1219 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 } | 1298 } |
| 1304 | 1299 |
| 1305 void PrerenderManager::RenderProcessHostDestroyed( | 1300 void PrerenderManager::RenderProcessHostDestroyed( |
| 1306 content::RenderProcessHost* host) { | 1301 content::RenderProcessHost* host) { |
| 1307 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1302 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1308 size_t erased = prerender_process_hosts_.erase(host); | 1303 size_t erased = prerender_process_hosts_.erase(host); |
| 1309 DCHECK_EQ(1u, erased); | 1304 DCHECK_EQ(1u, erased); |
| 1310 } | 1305 } |
| 1311 | 1306 |
| 1312 } // namespace prerender | 1307 } // namespace prerender |
| OLD | NEW |