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

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

Issue 2304953002: NoState Prefetch: nostate prefetch browser tests. (Closed)
Patch Set: histogram tests Created 4 years, 2 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_FACTORY_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_FACTORY_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_FACTORY_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_FACTORY_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 10 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
(...skipping 12 matching lines...) Expand all
23 // Listens for the Profile's destruction notification and cleans up the 23 // Listens for the Profile's destruction notification and cleans up the
24 // associated PrerenderManager. 24 // associated PrerenderManager.
25 class PrerenderManagerFactory : public BrowserContextKeyedServiceFactory { 25 class PrerenderManagerFactory : public BrowserContextKeyedServiceFactory {
26 public: 26 public:
27 // Returns the PrerenderManager for |profile|. 27 // Returns the PrerenderManager for |profile|.
28 static PrerenderManager* GetForBrowserContext( 28 static PrerenderManager* GetForBrowserContext(
29 content::BrowserContext* context); 29 content::BrowserContext* context);
30 30
31 static PrerenderManagerFactory* GetInstance(); 31 static PrerenderManagerFactory* GetInstance();
32 32
33 // As the prerender manager gets used very early in browser creation (eg, by
34 // the prerender tab helper), we can't use
35 // KeyedServiceFactory::SetTestingFactory, as the PrerenderManager has been
36 // created already by the time in-process browser tests are able to see a
37 // profile.
droger 2016/09/22 14:54:58 I don't think this is accurate. BuildServiceInsta
mattcary 2016/09/23 07:33:18 I think this issue is specific to the in-process b
droger 2016/09/23 08:15:36 My point is: - if the prerender manager is create
38 using PrerenderCreateFunction = PrerenderManager*(Profile*);
droger 2016/09/23 09:09:33 We don't need a profile here, BrowserContext is en
39 static void set_testing_create_function(
40 PrerenderCreateFunction create_function) {
41 testing_create_function_ = create_function;
42 }
43
33 private: 44 private:
34 friend struct base::DefaultSingletonTraits<PrerenderManagerFactory>; 45 friend struct base::DefaultSingletonTraits<PrerenderManagerFactory>;
35 46
36 PrerenderManagerFactory(); 47 PrerenderManagerFactory();
37 ~PrerenderManagerFactory() override; 48 ~PrerenderManagerFactory() override;
38 49
39 // BrowserContextKeyedServiceFactory: 50 // BrowserContextKeyedServiceFactory:
40 KeyedService* BuildServiceInstanceFor( 51 KeyedService* BuildServiceInstanceFor(
41 content::BrowserContext* profile) const override; 52 content::BrowserContext* profile) const override;
42 content::BrowserContext* GetBrowserContextToUse( 53 content::BrowserContext* GetBrowserContextToUse(
43 content::BrowserContext* context) const override; 54 content::BrowserContext* context) const override;
55
56 static PrerenderCreateFunction* testing_create_function_;
44 }; 57 };
45 58
46 } // namespace prerender 59 } // namespace prerender
47 60
48 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_FACTORY_H_ 61 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698