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

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

Issue 10553029: Handle interface to prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
(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/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/prerender/prerender_final_status.h"
11
12 namespace prerender {
13
14 class PrerenderContents;
15
16 // An opaque handle to a prerender.
17 class PrerenderHandleInterface :
gavinp 2012/06/17 17:41:15 I've now renamed this to PrerenderInterface, and p
dominich 2012/06/18 15:32:44 I /really/ don't understand why you need an interf
gavinp 2012/06/18 16:40:48 Hrm. 1. A prerender can be canceled by any one of
mmenke 2012/06/18 18:32:03 Seems like there are a lot of ways to implement th
18 public base::RefCounted<PrerenderHandleInterface>,
19 public base::SupportsWeakPtr<PrerenderHandleInterface> {
20 public:
21 virtual bool DidFinishLoading() const = 0;
22
23 // Is this prerender created, but not yet launched, as in a link prerender
24 // launched from a page that is itself prerendering?
25 virtual bool IsPending() const = 0;
26
27 protected:
28 PrerenderHandleInterface();
29 virtual ~PrerenderHandleInterface() = 0;
30
31 private:
32 friend class base::RefCounted<PrerenderHandleInterface>;
33 friend class PrerenderContents; // May call Destroy.
34
35 // Called from PrerenderContents, notifies this handle that this prerender
36 // either is no longer running, or never will run if it is not yet started.
37 // TODO(gavinp): Implement WeakScopedRefPtr, and use it to make this method
38 // redundant.
39 virtual void Destroy() = 0;
40 };
41
42 typedef scoped_refptr<PrerenderHandleInterface> PrerenderHandle;
43 typedef base::WeakPtr<PrerenderHandleInterface> WeakPrerenderHandle;
mmenke 2012/06/18 18:32:03 This just makes things hard to follow, and is actu
44
45 } // namespace prerender
46
47 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698