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

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: sky@ review. 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
« no previous file with comments | « chrome/browser/sessions/session_restore_delegate.cc ('k') | chrome/browser/sessions/tab_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..257483140494bd9a642513f3842a803a3a0a165d 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"
@@ -36,36 +37,41 @@ class TabLoader : public content::NotificationObserver,
public base::RefCounted<TabLoader>,
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);
+ using RestoredTab = SessionRestoreDelegate::RestoredTab;
Georges Khalil 2015/04/01 23:30:21 Necessary up here because of RestoreTabs function.
- // 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>;
- typedef std::set<content::NavigationController*> TabsLoading;
- typedef std::list<content::NavigationController*> TabsToLoad;
- typedef std::set<content::RenderWidgetHost*> RenderWidgetHostSet;
+ using TabsLoading = std::set<content::NavigationController*>;
+ using TabsToLoad = std::list<content::NavigationController*>;
+ using RenderWidgetHostSet = std::set<content::RenderWidgetHost*>;
Georges Khalil 2015/04/01 23:30:21 Changed to new syntax to match RestoredTab.
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 +80,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.
« no previous file with comments | « chrome/browser/sessions/session_restore_delegate.cc ('k') | chrome/browser/sessions/tab_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698