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

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: more standard code, simpler handle, no class explosion 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..a1b99db565d34e20de2d8af5ac2a41a5caeb1dbf
--- /dev/null
+++ b/chrome/browser/prerender/prerender_handle.h
@@ -0,0 +1,58 @@
+// 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 PrerenderHandle : public base::SupportsWeakPtr<PrerenderHandle>,
+ public base::NonThreadSafe {
dominich 2012/06/22 15:36:16 consider making this refcounted directly and see i
+ public:
+ ~PrerenderHandle();
+
+ bool Matches(
+ const GURL& url,
+ const content::SessionStorageNamespace* session_storage_namespace) const;
+
+ bool IsPending() const;
+ bool IsPrerendering() const { return !IsPending(); }
+
+ bool DidFinishLoading() const;
+
+ void DecrementClientCount();
+
+ private:
+ friend class PrerenderManager;
+
+ PrerenderHandle();
+
+ void AddDuplicate(scoped_ptr<PrerenderHandle> new_duplicate_handle);
+
+ PrerenderContents* contents() const { return contents_; }
dominich 2012/06/22 15:36:16 not sure i understand the point of an accessor at
mmenke 2012/06/22 16:12:45 I generally do it when something is called by a fr
+ void SetContents(PrerenderContents* contents);
+
+ PrerenderContents* contents_;
+
+ // Another prerender handle, owned by this one, which refers to the same
+ // PrerenderContents.
dominich 2012/06/22 15:36:16 what for?
+ scoped_ptr<PrerenderHandle> duplicate_handle_;
+};
+
+} // namespace prerender
+
+#endif // CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_

Powered by Google App Engine
This is Rietveld 408576698