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

Unified Diff: components/sync_sessions/task_tracker.h

Issue 2868043003: Track task ids for navigations cross multiple tabs. (Closed)
Patch Set: using task_ids_ to hold tasks from source tab Created 3 years, 7 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: components/sync_sessions/task_tracker.h
diff --git a/components/sync_sessions/task_tracker.h b/components/sync_sessions/task_tracker.h
index 44ee36368a6f879822bf5f8a15dc8cb2878d9d02..70fb0a0906fe8ed618e43d4b66f22e95cc7afaab 100644
--- a/components/sync_sessions/task_tracker.h
+++ b/components/sync_sessions/task_tracker.h
@@ -29,10 +29,10 @@ namespace sync_sessions {
// TODO(shenchao): If the tab is restored, then the input navigation is not
// necessarily the first navigation in this case. Need to fix it by initalizing
// the object with restored data.
-// TODO(shenchao): Support to track tasks cross tabs.
class TabTasks {
public:
TabTasks();
+ explicit TabTasks(const TabTasks* source_tab);
virtual ~TabTasks();
// Gets top-down task id list of ancestors and itself for
@@ -64,6 +64,14 @@ class TabTasks {
int64_t task_id;
};
+ // Get position of task_ids_ for the navigation at |navigation_index| of the
Nicolas Zea 2017/05/16 17:13:33 nit: position of -> position within
shenchao 2017/05/17 16:48:16 Done.
+ // tab.
+ int GetTaskIdPositionFromNavigationIndex(int navigation_index) const;
+
+ // Get navigation_index of corresponding navigation of the tab at
Nicolas Zea 2017/05/16 17:13:33 nit: Get navigation_index of -> Get index of
shenchao 2017/05/17 16:48:16 Done.
+ // |task_id_position| of task_ids_.
+ int GetNavigationIndexFromTaskIdPosition(int task_id_position) const;
+
// Task ids (with root task) for the navigations of the tab. The vector is
// corresponding to the sequence of navigations of the tab.
std::vector<TaskIdAndRoot> task_ids_;
@@ -72,6 +80,8 @@ class TabTasks {
// Number of oldest ancestors which have been excluded from being tracked in
// task_ids_;
int excluded_navigation_num_ = 0;
+ // Number of tasks from source tab.
+ int source_tab_task_num_ = 0;
DISALLOW_COPY_AND_ASSIGN(TabTasks);
};
@@ -87,6 +97,11 @@ class TaskTracker {
// given |tab_id|.
TabTasks* GetTabTasks(SessionID::id_type tab_id);
+ // Returns a TabTasks pointer, which is owned by this object, for the tab of
+ // given |tab_id|, which is created from a source tab |source_tab_id|.
+ TabTasks* GetTabTasks(SessionID::id_type tab_id,
+ SessionID::id_type source_tab_id);
+
// Cleans tracked task ids of navigations in the tab of |tab_id|.
void CleanTabTasks(SessionID::id_type tab_id);

Powered by Google App Engine
This is Rietveld 408576698