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 19 matching lines...) Expand all Loading... |
30 #include "chrome/browser/prerender/prerender_util.h" | 30 #include "chrome/browser/prerender/prerender_util.h" |
31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 32 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
34 #include "chrome/common/chrome_notification_types.h" | 34 #include "chrome/common/chrome_notification_types.h" |
35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/render_messages.h" | 36 #include "chrome/common/render_messages.h" |
37 #include "content/browser/cancelable_request.h" | 37 #include "content/browser/cancelable_request.h" |
38 #include "content/browser/debugger/render_view_devtools_agent_host.h" | 38 #include "content/browser/debugger/render_view_devtools_agent_host.h" |
39 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 39 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
40 #include "content/browser/renderer_host/render_process_host.h" | |
41 #include "content/browser/renderer_host/render_view_host.h" | 40 #include "content/browser/renderer_host/render_view_host.h" |
42 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 41 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
43 #include "content/browser/tab_contents/render_view_host_manager.h" | 42 #include "content/browser/tab_contents/render_view_host_manager.h" |
44 #include "content/browser/tab_contents/tab_contents.h" | 43 #include "content/browser/tab_contents/tab_contents.h" |
45 #include "content/browser/tab_contents/tab_contents_delegate.h" | 44 #include "content/browser/tab_contents/tab_contents_delegate.h" |
46 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
47 #include "content/public/browser/notification_observer.h" | 46 #include "content/public/browser/notification_observer.h" |
48 #include "content/public/browser/notification_registrar.h" | 47 #include "content/public/browser/notification_registrar.h" |
49 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
| 49 #include "content/public/browser/render_process_host.h" |
50 | 50 |
51 using content::BrowserThread; | 51 using content::BrowserThread; |
52 | 52 |
53 namespace prerender { | 53 namespace prerender { |
54 | 54 |
55 namespace { | 55 namespace { |
56 | 56 |
57 // Time window for which we will record windowed PLT's from the last | 57 // Time window for which we will record windowed PLT's from the last |
58 // observed link rel=prefetch tag. | 58 // observed link rel=prefetch tag. |
59 const int kWindowDurationSeconds = 30; | 59 const int kWindowDurationSeconds = 30; |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 } | 1131 } |
1132 | 1132 |
1133 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 1133 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
1134 int render_process_id) { | 1134 int render_process_id) { |
1135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1136 RenderProcessHost* render_process_host = | 1136 RenderProcessHost* render_process_host = |
1137 RenderProcessHost::FromID(render_process_id); | 1137 RenderProcessHost::FromID(render_process_id); |
1138 // Each render process is guaranteed to only hold RenderViews owned by the | 1138 // Each render process is guaranteed to only hold RenderViews owned by the |
1139 // same BrowserContext. This is enforced by | 1139 // same BrowserContext. This is enforced by |
1140 // RenderProcessHost::GetExistingProcessHost. | 1140 // RenderProcessHost::GetExistingProcessHost. |
1141 if (!render_process_host || !render_process_host->browser_context()) | 1141 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1142 return NULL; | 1142 return NULL; |
1143 Profile* profile = Profile::FromBrowserContext( | 1143 Profile* profile = Profile::FromBrowserContext( |
1144 render_process_host->browser_context()); | 1144 render_process_host->GetBrowserContext()); |
1145 if (!profile) | 1145 if (!profile) |
1146 return NULL; | 1146 return NULL; |
1147 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1147 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1148 } | 1148 } |
1149 | 1149 |
1150 } // namespace prerender | 1150 } // namespace prerender |
OLD | NEW |