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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 using content::BrowserThread; | 56 using content::BrowserThread; |
57 using content::RenderViewHost; | 57 using content::RenderViewHost; |
58 using content::SessionStorageNamespace; | 58 using content::SessionStorageNamespace; |
59 using content::WebContents; | 59 using content::WebContents; |
60 | 60 |
61 namespace prerender { | 61 namespace prerender { |
62 | 62 |
63 namespace { | 63 namespace { |
64 | 64 |
65 // Time window for which we will record windowed PLT's from the last | |
66 // observed link rel=prefetch tag. | |
67 const int kWindowDurationSeconds = 30; | |
68 | |
69 // Time interval at which periodic cleanups are performed. | 65 // Time interval at which periodic cleanups are performed. |
70 const int kPeriodicCleanupIntervalMs = 1000; | 66 const int kPeriodicCleanupIntervalMs = 1000; |
71 | 67 |
72 // Time interval before a new prerender is allowed. | 68 // Time interval before a new prerender is allowed. |
73 const int kMinTimeBetweenPrerendersMs = 500; | 69 const int kMinTimeBetweenPrerendersMs = 500; |
74 | 70 |
75 // Valid HTTP methods for prerendering. | 71 // Valid HTTP methods for prerendering. |
76 const char* const kValidHttpMethods[] = { | 72 const char* const kValidHttpMethods[] = { |
77 "GET", | 73 "GET", |
78 "HEAD", | 74 "HEAD", |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1220 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1225 return NULL; | 1221 return NULL; |
1226 Profile* profile = Profile::FromBrowserContext( | 1222 Profile* profile = Profile::FromBrowserContext( |
1227 render_process_host->GetBrowserContext()); | 1223 render_process_host->GetBrowserContext()); |
1228 if (!profile) | 1224 if (!profile) |
1229 return NULL; | 1225 return NULL; |
1230 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1226 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1231 } | 1227 } |
1232 | 1228 |
1233 } // namespace prerender | 1229 } // namespace prerender |
OLD | NEW |