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

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

Issue 1052733002: Decouple TabLoader from SessionRestore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/sessions/tab_loader.h
diff --git a/chrome/browser/sessions/tab_loader.h b/chrome/browser/sessions/tab_loader.h
index 0204cb31f452665b17360efaf6ef0d6924313765..6f21962bc3377b2336f14774b4eb5de9da01c04e 100644
--- a/chrome/browser/sessions/tab_loader.h
+++ b/chrome/browser/sessions/tab_loader.h
@@ -11,6 +11,7 @@
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer/timer.h"
+#include "chrome/browser/sessions/session_restore_delegate.h"
#include "chrome/browser/sessions/tab_loader_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -34,28 +35,22 @@ class RenderWidgetHost;
// of SessionRestoreImpl doesn't have timing problems.
class TabLoader : public content::NotificationObserver,
public base::RefCounted<TabLoader>,
+ public SessionRestoreDelegate,
public TabLoaderCallback {
public:
- // Retrieves a pointer to the TabLoader instance shared between profiles, or
- // creates a new TabLoader if it doesn't exist. If a TabLoader is created, its
- // starting timestamp is set to |restore_started|.
- static TabLoader* GetTabLoader(base::TimeTicks restore_started);
-
- // Schedules a tab for loading.
- void ScheduleLoad(content::NavigationController* controller);
-
- // Notifies the loader that a tab has been scheduled for loading through
- // some other mechanism.
- void TabIsLoading(content::NavigationController* controller);
-
- // Invokes |LoadNextTab| to load a tab.
- //
- // This must be invoked once to start loading.
- void StartLoading();
+ // NotificationObserver method. Removes the specified tab and loads the next
+ // tab.
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
// TabLoaderCallback:
void SetTabLoadingEnabled(bool enable_tab_loading) override;
+ // Called to start restoring tabs.
+ static void RestoreTabs(const std::vector<RestoredTab>& tabs_,
+ const base::TimeTicks& restore_started);
+
private:
friend class base::RefCounted<TabLoader>;
@@ -66,6 +61,16 @@ class TabLoader : public content::NotificationObserver,
explicit TabLoader(base::TimeTicks restore_started);
~TabLoader() override;
+ // This is invoked once by RestoreTabs to start loading.
+ void StartLoading(const std::vector<RestoredTab>& tabs);
+
+ // Schedules a tab for loading.
+ void ScheduleLoad(content::NavigationController* controller);
+
+ // Notifies the loader that a tab has been scheduled for loading through
+ // some other mechanism.
+ void TabIsLoading(content::NavigationController* controller);
+
// Loads the next tab. If there are no more tabs to load this deletes itself,
// otherwise |force_load_timer_| is restarted.
void LoadNextTab();
@@ -74,12 +79,6 @@ class TabLoader : public content::NotificationObserver,
// tab loading is finished.
void StartTimer();
- // NotificationObserver method. Removes the specified tab and loads the next
- // tab.
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
// Removes the listeners from the specified tab and removes the tab from
// the set of tabs to load and list of tabs we're waiting to get a load
// from.

Powered by Google App Engine
This is Rietveld 408576698