Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/prerender/prerender_manager.h

Issue 2275933002: Experiment to disable Prerendering with fast wind-down (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove FRIEND_TEST_ALL_PREFIXES Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // from a prerendering perspective. Currently, if Prerender Cookie Stores are 314 // from a prerendering perspective. Currently, if Prerender Cookie Stores are
315 // enabled, prerenders must be in their own processes that may not be shared. 315 // enabled, prerenders must be in their own processes that may not be shared.
316 bool MayReuseProcessHost(content::RenderProcessHost* process_host); 316 bool MayReuseProcessHost(content::RenderProcessHost* process_host);
317 317
318 // content::RenderProcessHostObserver implementation. 318 // content::RenderProcessHostObserver implementation.
319 void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; 319 void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
320 320
321 void SetPrerenderContentsFactoryForTest( 321 void SetPrerenderContentsFactoryForTest(
322 PrerenderContents::Factory* prerender_contents_factory); 322 PrerenderContents::Factory* prerender_contents_factory);
323 323
324 bool IsPrerenderSilenceExperimentForTesting(Origin origin) const {
325 return IsPrerenderSilenceExperiment(origin);
326 }
327
324 protected: 328 protected:
325 class PrerenderData : public base::SupportsWeakPtr<PrerenderData> { 329 class PrerenderData : public base::SupportsWeakPtr<PrerenderData> {
326 public: 330 public:
327 struct OrderByExpiryTime; 331 struct OrderByExpiryTime;
328 332
329 PrerenderData(PrerenderManager* manager, 333 PrerenderData(PrerenderManager* manager,
330 std::unique_ptr<PrerenderContents> contents, 334 std::unique_ptr<PrerenderContents> contents,
331 base::TimeTicks expiry_time); 335 base::TimeTicks expiry_time);
332 336
333 ~PrerenderData(); 337 ~PrerenderData();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 class OnCloseWebContentsDeleter; 403 class OnCloseWebContentsDeleter;
400 struct NavigationRecord; 404 struct NavigationRecord;
401 using PrerenderDataVector = std::vector<std::unique_ptr<PrerenderData>>; 405 using PrerenderDataVector = std::vector<std::unique_ptr<PrerenderData>>;
402 406
403 // Time interval before a new prerender is allowed. 407 // Time interval before a new prerender is allowed.
404 static const int kMinTimeBetweenPrerendersMs = 500; 408 static const int kMinTimeBetweenPrerendersMs = 500;
405 409
406 // Time window for which we record old navigations, in milliseconds. 410 // Time window for which we record old navigations, in milliseconds.
407 static const int kNavigationRecordWindowMs = 5000; 411 static const int kNavigationRecordWindowMs = 5000;
408 412
413 // Returns whether adding new prerenders should be disabled because of the
414 // experiment running.
415 bool IsPrerenderSilenceExperiment(Origin origin) const;
416
409 // Returns whether prerendering is currently enabled or the reason why it is 417 // Returns whether prerendering is currently enabled or the reason why it is
410 // disabled. 418 // disabled.
411 chrome_browser_net::NetworkPredictionStatus GetPredictionStatus() const; 419 chrome_browser_net::NetworkPredictionStatus GetPredictionStatus() const;
412 420
413 // Returns whether prerendering is currently enabled or the reason why it is 421 // Returns whether prerendering is currently enabled or the reason why it is
414 // disabled after taking into account the origin of the request. 422 // disabled after taking into account the origin of the request.
415 chrome_browser_net::NetworkPredictionStatus GetPredictionStatusForOrigin( 423 chrome_browser_net::NetworkPredictionStatus GetPredictionStatusForOrigin(
416 Origin origin) const; 424 Origin origin) const;
417 425
418 // Adds a prerender for |url| from |referrer|. The |origin| specifies how the 426 // Adds a prerender for |url| from |referrer|. The |origin| specifies how the
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 // Set of process hosts being prerendered. 571 // Set of process hosts being prerendered.
564 using PrerenderProcessSet = std::set<content::RenderProcessHost*>; 572 using PrerenderProcessSet = std::set<content::RenderProcessHost*>;
565 PrerenderProcessSet prerender_process_hosts_; 573 PrerenderProcessSet prerender_process_hosts_;
566 574
567 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); 575 DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
568 }; 576 };
569 577
570 } // namespace prerender 578 } // namespace prerender
571 579
572 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 580 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_manager.cc » ('j') | chrome/browser/prerender/prerender_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698