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

Unified Diff: chrome/browser/sessions/session_restore.h

Issue 2930013005: [Tab Metrics] Measure FP, FCP and FMP for Foreground Tab during Session Restore (Closed)
Patch Set: Add RemoveFromWebContents() to RestoreOrigin. Created 3 years, 5 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
« no previous file with comments | « chrome/browser/resource_coordinator/tab_manager.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore.h
diff --git a/chrome/browser/sessions/session_restore.h b/chrome/browser/sessions/session_restore.h
index 17090a514c97928dc4fa5ebbe29d7e4b60d7986a..3e5229198e19e32aa38925e2e3c8adef4106b8c4 100644
--- a/chrome/browser/sessions/session_restore.h
+++ b/chrome/browser/sessions/session_restore.h
@@ -17,6 +17,7 @@
#include "chrome/browser/sessions/session_restore_observer.h"
#include "components/history/core/browser/history_service.h"
#include "components/sessions/core/session_types.h"
+#include "content/public/browser/web_contents_user_data.h"
#include "ui/base/window_open_disposition.h"
class Browser;
@@ -27,6 +28,28 @@ namespace content {
class WebContents;
}
+// Indicate the origin of the restoration of web contents (e.g., session
+// restore, reopening closed tab, and restore foreign tab). A tab
+// holds a valid instance of this class only when the tab is loading during
+// session restore.
+class RestoreOrigin : public content::WebContentsUserData<RestoreOrigin> {
sky 2017/07/25 16:48:00 I think the enum makes sense if it's going to be a
chrisha 2017/07/25 19:00:50 +1 to this idea.
+ public:
+ enum class Type { SESSION_RESTORE };
+
+ static void CreateForWebContents(content::WebContents* contents,
+ RestoreOrigin::Type type);
+ static void RemoveFromWebContents(content::WebContents* contents);
+ ~RestoreOrigin() override;
+
+ Type type() const { return type_; }
+
+ private:
+ friend class content::WebContentsUserData<RestoreOrigin>;
+ explicit RestoreOrigin(Type type);
+
+ Type type_;
+};
+
// SessionRestore handles restoring either the last or saved session. Session
// restore come in two variants, asynchronous or synchronous. The synchronous
// variety is meant for startup and blocks until restore is complete.
« no previous file with comments | « chrome/browser/resource_coordinator/tab_manager.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698