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 #ifndef CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_ |
6 #define CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_ | 6 #define CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/renderer/render_process_observer.h" | 13 #include "content/public/renderer/render_process_observer.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace prerender { | 17 namespace prerender { |
17 | 18 |
| 19 class PrerenderingSupport; |
| 20 |
18 // PrerenderDispatcher keeps track of which URLs are being prerendered. There | 21 // PrerenderDispatcher keeps track of which URLs are being prerendered. There |
19 // is only one PrerenderDispatcher per render process, and it will only be | 22 // is only one PrerenderDispatcher per render process, and it will only be |
20 // aware of prerenders that are triggered by this render process. | 23 // aware of prerenders that are triggered by this render process. As well, |
| 24 // it holds on to other objects that must exist once per-renderer process, |
| 25 // such as the PrerenderingSupport. |
21 class PrerenderDispatcher : public content::RenderProcessObserver { | 26 class PrerenderDispatcher : public content::RenderProcessObserver { |
22 public: | 27 public: |
23 PrerenderDispatcher(); | 28 PrerenderDispatcher(); |
24 virtual ~PrerenderDispatcher(); | 29 virtual ~PrerenderDispatcher(); |
25 | 30 |
26 bool IsPrerenderURL(const GURL & url) const; | 31 bool IsPrerenderURL(const GURL & url) const; |
27 | 32 |
28 private: | 33 private: |
29 void OnAddPrerenderURL(const GURL& url); | 34 void OnAddPrerenderURL(const GURL& url); |
30 void OnRemovePrerenderURL(const GURL& url); | 35 void OnRemovePrerenderURL(const GURL& url); |
31 | 36 |
32 // RenderProcessObserver: | 37 // RenderProcessObserver: |
33 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 38 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
34 | 39 |
35 typedef std::map<GURL, int> PrerenderMap; | 40 typedef std::map<GURL, int> PrerenderMap; |
36 PrerenderMap prerender_urls_; | 41 PrerenderMap prerender_urls_; |
| 42 |
| 43 // There is one PrerenderingSupport object per renderer, and it provides |
| 44 // the interface to prerendering to the WebKit platform. |
| 45 scoped_ptr<PrerenderingSupport> prerendering_support_; |
37 }; | 46 }; |
38 | 47 |
39 } // namespace prerender | 48 } // namespace prerender |
40 | 49 |
41 #endif // CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_ | 50 #endif // CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_ |
OLD | NEW |