OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 if (!session_storage_namespace && source_render_view_host) { | 440 if (!session_storage_namespace && source_render_view_host) { |
441 session_storage_namespace = | 441 session_storage_namespace = |
442 source_render_view_host->session_storage_namespace(); | 442 source_render_view_host->session_storage_namespace(); |
443 } | 443 } |
444 | 444 |
445 PrerenderContents* prerender_contents = CreatePrerenderContents( | 445 PrerenderContents* prerender_contents = CreatePrerenderContents( |
446 url, referrer, origin, experiment); | 446 url, referrer, origin, experiment); |
447 if (!prerender_contents || !prerender_contents->Init()) | 447 if (!prerender_contents || !prerender_contents->Init()) |
448 return false; | 448 return false; |
449 | 449 |
| 450 histograms_->RecordPrerenderStarted(origin); |
| 451 |
450 // TODO(cbentzel): Move invalid checks here instead of PrerenderContents? | 452 // TODO(cbentzel): Move invalid checks here instead of PrerenderContents? |
451 PrerenderContentsData data(prerender_contents, GetCurrentTime()); | 453 PrerenderContentsData data(prerender_contents, GetCurrentTime()); |
452 | 454 |
453 prerender_list_.push_back(data); | 455 prerender_list_.push_back(data); |
454 | 456 |
455 if (IsControlGroup()) { | 457 if (IsControlGroup()) { |
456 data.contents_->set_final_status(FINAL_STATUS_CONTROL_GROUP); | 458 data.contents_->set_final_status(FINAL_STATUS_CONTROL_GROUP); |
457 } else { | 459 } else { |
458 last_prerender_start_time_ = GetCurrentTimeTicks(); | 460 last_prerender_start_time_ = GetCurrentTimeTicks(); |
459 data.contents_->StartPrerendering(source_render_view_host, | 461 data.contents_->StartPrerendering(source_render_view_host, |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1156 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1155 return NULL; | 1157 return NULL; |
1156 Profile* profile = Profile::FromBrowserContext( | 1158 Profile* profile = Profile::FromBrowserContext( |
1157 render_process_host->GetBrowserContext()); | 1159 render_process_host->GetBrowserContext()); |
1158 if (!profile) | 1160 if (!profile) |
1159 return NULL; | 1161 return NULL; |
1160 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1162 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1161 } | 1163 } |
1162 | 1164 |
1163 } // namespace prerender | 1165 } // namespace prerender |
OLD | NEW |