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

Side by Side Diff: chrome/browser/sessions/session_restore.h

Issue 902613003: Record the number of tabs in a session restore in SampledProfile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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_SESSIONS_SESSION_RESTORE_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 22 matching lines...) Expand all
33 // Indicates that if there is a problem restoring the last session then a 33 // Indicates that if there is a problem restoring the last session then a
34 // new tabbed browser should be created. 34 // new tabbed browser should be created.
35 ALWAYS_CREATE_TABBED_BROWSER = 1 << 1, 35 ALWAYS_CREATE_TABBED_BROWSER = 1 << 1,
36 36
37 // Restore blocks until complete. This is intended for use during startup 37 // Restore blocks until complete. This is intended for use during startup
38 // when we want to block until restore is complete. 38 // when we want to block until restore is complete.
39 SYNCHRONOUS = 1 << 2, 39 SYNCHRONOUS = 1 << 2,
40 }; 40 };
41 41
42 // Notification callback list. 42 // Notification callback list.
43 using CallbackList = base::CallbackList<void(void)>; 43 using CallbackList = base::CallbackList<void(int)>;
44 44
45 // Used by objects calling RegisterOnSessionRestoredCallback() to de-register 45 // Used by objects calling RegisterOnSessionRestoredCallback() to de-register
46 // themselves when they are destroyed. 46 // themselves when they are destroyed.
47 using CallbackSubscription = 47 using CallbackSubscription =
48 scoped_ptr<base::CallbackList<void(void)>::Subscription>; 48 scoped_ptr<base::CallbackList<void(int)>::Subscription>;
49 49
50 // Restores the last session. |behavior| is a bitmask of Behaviors, see it 50 // Restores the last session. |behavior| is a bitmask of Behaviors, see it
51 // for details. If |browser| is non-null the tabs for the first window are 51 // for details. If |browser| is non-null the tabs for the first window are
52 // added to it. Returns the last active browser. 52 // added to it. Returns the last active browser.
53 // Every additional browser created will be created on the desktop specified 53 // Every additional browser created will be created on the desktop specified
54 // by |host_desktop_type|, if |browser| is non-null it should have the same 54 // by |host_desktop_type|, if |browser| is non-null it should have the same
55 // desktop type. 55 // desktop type.
56 // 56 //
57 // If |urls_to_open| is non-empty, a tab is added for each of the URLs. 57 // If |urls_to_open| is non-empty, a tab is added for each of the URLs.
58 static Browser* RestoreSession(Profile* profile, 58 static Browser* RestoreSession(Profile* profile,
(...skipping 26 matching lines...) Expand all
85 const sessions::SessionTab& tab, 85 const sessions::SessionTab& tab,
86 WindowOpenDisposition disposition); 86 WindowOpenDisposition disposition);
87 87
88 // Returns true if we're in the process of restoring |profile|. 88 // Returns true if we're in the process of restoring |profile|.
89 static bool IsRestoring(const Profile* profile); 89 static bool IsRestoring(const Profile* profile);
90 90
91 // Returns true if synchronously restoring a session. 91 // Returns true if synchronously restoring a session.
92 static bool IsRestoringSynchronously(); 92 static bool IsRestoringSynchronously();
93 93
94 // Register callbacks for session restore events. These callbacks are stored 94 // Register callbacks for session restore events. These callbacks are stored
95 // in on_session_restored_callbacks_. 95 // in on_session_restored_callbacks_.
sky 2015/02/04 21:22:11 You need to document what the int means.
Simon Que 2015/02/05 00:16:01 Done.
96 static CallbackSubscription RegisterOnSessionRestoredCallback( 96 static CallbackSubscription RegisterOnSessionRestoredCallback(
97 const base::Closure& callback); 97 const base::Callback<void(int)>& callback);
98 98
99 // The max number of non-selected tabs SessionRestore loads when restoring 99 // The max number of non-selected tabs SessionRestore loads when restoring
100 // a session. A value of 0 indicates all tabs are loaded at once. 100 // a session. A value of 0 indicates all tabs are loaded at once.
101 static size_t num_tabs_to_load_; 101 static size_t num_tabs_to_load_;
102 102
103 private: 103 private:
104 SessionRestore(); 104 SessionRestore();
105 105
106 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the 106 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the
107 // first time so that it always returns a valid object. 107 // first time so that it always returns a valid object.
108 static CallbackList* on_session_restored_callbacks() { 108 static CallbackList* on_session_restored_callbacks() {
109 if (!on_session_restored_callbacks_) 109 if (!on_session_restored_callbacks_)
110 on_session_restored_callbacks_ = new CallbackList(); 110 on_session_restored_callbacks_ = new CallbackList();
111 return on_session_restored_callbacks_; 111 return on_session_restored_callbacks_;
112 } 112 }
113 113
114 // Contains all registered callbacks for session restore notifications. 114 // Contains all registered callbacks for session restore notifications.
115 static CallbackList* on_session_restored_callbacks_; 115 static CallbackList* on_session_restored_callbacks_;
116 116
117 DISALLOW_COPY_AND_ASSIGN(SessionRestore); 117 DISALLOW_COPY_AND_ASSIGN(SessionRestore);
118 }; 118 };
119 119
120 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ 120 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698