OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_ | |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_ | |
7 | |
8 #include "base/threading/non_thread_safe.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 | |
12 class GURL; | |
13 | |
14 namespace content { | |
15 class SessionStorageNamespace; | |
16 } | |
17 | |
18 namespace prerender { | |
19 | |
20 class PrerenderContents; | |
21 class PrerenderManager; | |
22 | |
23 class PrerenderHandleImpl : public base::SupportsWeakPtr<PrerenderHandleImpl>, | |
24 public base::NonThreadSafe { | |
25 public: | |
26 ~PrerenderHandleImpl(); | |
27 | |
28 bool IsPending() const; | |
29 bool IsPrerendering() const { return !IsPending(); } | |
30 | |
31 bool DidFinishLoading() const; | |
32 | |
33 void Release(); | |
34 | |
35 protected: | |
36 friend class PrerenderBrowserTest; | |
37 friend class PrerenderContents; | |
38 friend class PrerenderManager; | |
39 | |
40 PrerenderHandleImpl(); | |
41 | |
42 void AddDuplicate(PrerenderHandleImpl* new_duplicate_handle); | |
43 void AddClient(); | |
44 | |
45 PrerenderContents* contents() const { return contents_; } | |
46 void SetContents(PrerenderContents* contents); | |
47 | |
48 private: | |
49 PrerenderContents* contents_; | |
50 | |
51 // Another prerender handle, owned by this one, which refers to the same | |
52 // PrerenderContents. This ends up being effectively a list, since our | |
dominich
2012/06/28 00:34:32
my non-lisp brain still wants this to be a scoped_
| |
53 // duplicate_handle_ can itself have a duplicate_handle_. | |
54 scoped_ptr<PrerenderHandleImpl> duplicate_handle_; | |
55 }; | |
mmenke
2012/06/28 16:01:28
How not get rid of duplicate_handle_ and AddDuplic
mmenke
2012/06/28 16:02:32
Erm... That should be "Why not just get" (Or "How
| |
56 | |
57 typedef base::WeakPtr<PrerenderHandleImpl> PrerenderHandle; | |
dominich
2012/06/28 00:34:32
i love this so hard.
| |
58 | |
59 } // namespace prerender | |
60 | |
61 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_ | |
OLD | NEW |