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

Side by Side Diff: chrome/browser/win/jumplist.h

Issue 2868303003: Cancel the next 10 updates if there's a timeout in jumplist updater (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/win/jumplist.cc » ('j') | chrome/browser/win/jumplist.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_WIN_JUMPLIST_H_ 5 #ifndef CHROME_BROWSER_WIN_JUMPLIST_H_
6 #define CHROME_BROWSER_WIN_JUMPLIST_H_ 6 #define CHROME_BROWSER_WIN_JUMPLIST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 // Posts tasks to update the JumpList and delete any obsolete JumpList related 164 // Posts tasks to update the JumpList and delete any obsolete JumpList related
165 // folders. 165 // folders.
166 void PostRunUpdate(); 166 void PostRunUpdate();
167 167
168 // history::TopSitesObserver implementation. 168 // history::TopSitesObserver implementation.
169 void TopSitesLoaded(history::TopSites* top_sites) override; 169 void TopSitesLoaded(history::TopSites* top_sites) override;
170 void TopSitesChanged(history::TopSites* top_sites, 170 void TopSitesChanged(history::TopSites* top_sites,
171 ChangeReason change_reason) override; 171 ChangeReason change_reason) override;
172 172
173 // Checks if the timeout flag |jumplist_updater_timeout_| is true and updates
174 // the flag and |cancelled_update_count_| accordingly.
175 // Returns true if |jumplist_updater_timeout_| is still true after being
176 // updated.
177 bool CheckAndUpdateTimeoutInfo();
178
173 // Called on a timer to update the most visited URLs after requests storms 179 // Called on a timer to update the most visited URLs after requests storms
174 // have subsided. 180 // have subsided.
175 void DeferredTopSitesChanged(); 181 void DeferredTopSitesChanged();
176 182
177 // Called on a timer to update the "Recently Closed" category of JumpList 183 // Called on a timer to update the "Recently Closed" category of JumpList
178 // after requests storms have subsided. 184 // after requests storms have subsided.
179 void DeferredTabRestoreServiceChanged(); 185 void DeferredTabRestoreServiceChanged();
180 186
181 // Creates at most |max_items| icon files in |icon_dir| for the 187 // Creates at most |max_items| icon files in |icon_dir| for the
182 // asynchrounously loaded icons stored in |item_list|. 188 // asynchrounously loaded icons stored in |item_list|.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 base::string16 app_id_; 231 base::string16 app_id_;
226 232
227 // Timer for requesting delayed updates of the "Most Visited" category of 233 // Timer for requesting delayed updates of the "Most Visited" category of
228 // jumplist. 234 // jumplist.
229 base::OneShotTimer timer_most_visited_; 235 base::OneShotTimer timer_most_visited_;
230 236
231 // Timer for requesting delayed updates of the "Recently Closed" category of 237 // Timer for requesting delayed updates of the "Recently Closed" category of
232 // jumplist. 238 // jumplist.
233 base::OneShotTimer timer_recently_closed_; 239 base::OneShotTimer timer_recently_closed_;
234 240
241 // The number of jumplist updates cancelled intentionally due to jumplist
242 // updater timeout.
243 int cancelled_update_count_;
gab 2017/05/12 17:58:47 Initialize member inline here instead of in constr
chengx 2017/05/12 18:53:38 Done.
244
245 // A boolean flag indicating if there's a timeout in jumplist updater. This
246 // flag will be cleared after the following |kCancelledUpdates| jumplist
247 // updates are cancelled intentionally.
248 bool jumplist_updater_timeout_;
gab 2017/05/12 17:58:47 Actually you don't need the bool, you can do this
chengx 2017/05/12 18:53:38 Agreed. I've updated the logic in the new patch se
249
235 // Holds data that can be accessed from multiple threads. 250 // Holds data that can be accessed from multiple threads.
236 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; 251 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_;
237 252
238 // Id of last favicon task. It's used to cancel current task if a new one 253 // Id of last favicon task. It's used to cancel current task if a new one
239 // comes in before it finishes. 254 // comes in before it finishes.
240 base::CancelableTaskTracker::TaskId task_id_; 255 base::CancelableTaskTracker::TaskId task_id_;
241 256
242 // A task runner running tasks to update the JumpList. 257 // A task runner running tasks to update the JumpList.
243 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; 258 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_;
244 259
245 // A task runner running tasks to delete JumpListIcons directory and 260 // A task runner running tasks to delete JumpListIcons directory and
246 // JumpListIconsOld directory. 261 // JumpListIconsOld directory.
247 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; 262 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_;
248 263
249 // For callbacks may be run after destruction. 264 // For callbacks may be run after destruction.
250 base::WeakPtrFactory<JumpList> weak_ptr_factory_; 265 base::WeakPtrFactory<JumpList> weak_ptr_factory_;
251 266
252 DISALLOW_COPY_AND_ASSIGN(JumpList); 267 DISALLOW_COPY_AND_ASSIGN(JumpList);
253 }; 268 };
254 269
255 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ 270 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/win/jumplist.cc » ('j') | chrome/browser/win/jumplist.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698