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

Unified 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: remediated, and cleaned up in prep for uploading for review 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prerender/prerender_handle.h
diff --git a/chrome/browser/prerender/prerender_handle.h b/chrome/browser/prerender/prerender_handle.h
new file mode 100644
index 0000000000000000000000000000000000000000..be89c4ee775072fc628e7df439fb0e93d5440967
--- /dev/null
+++ b/chrome/browser/prerender/prerender_handle.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_
+#define CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_
+
+#include "base/threading/non_thread_safe.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+
+class GURL;
+
+namespace content {
+class SessionStorageNamespace;
+}
+
+namespace prerender {
+
+class PrerenderContents;
+class PrerenderManager;
+
+class PrerenderHandleImpl : public base::SupportsWeakPtr<PrerenderHandleImpl>,
+ public base::NonThreadSafe {
+ public:
+ ~PrerenderHandleImpl();
+
+ bool IsPending() const;
+ bool IsPrerendering() const { return !IsPending(); }
+
+ bool DidFinishLoading() const;
+
+ void Release();
+
+ protected:
+ friend class PrerenderBrowserTest;
+ friend class PrerenderContents;
+ friend class PrerenderManager;
+
+ PrerenderHandleImpl();
+
+ void AddDuplicate(PrerenderHandleImpl* new_duplicate_handle);
+ void AddClient();
+
+ PrerenderContents* contents() const { return contents_; }
+ void SetContents(PrerenderContents* contents);
+
+ private:
+ PrerenderContents* contents_;
+
+ // Another prerender handle, owned by this one, which refers to the same
+ // 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_
+ // duplicate_handle_ can itself have a duplicate_handle_.
+ scoped_ptr<PrerenderHandleImpl> duplicate_handle_;
+};
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
+
+typedef base::WeakPtr<PrerenderHandleImpl> PrerenderHandle;
dominich 2012/06/28 00:34:32 i love this so hard.
+
+} // namespace prerender
+
+#endif // CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_

Powered by Google App Engine
This is Rietveld 408576698