OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_BACKEND_H_ |
6 #define CHROME_BROWSER_SESSIONS_SESSION_BACKEND_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_BACKEND_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // Moves the current file to the last file, and recreates the current file. | 52 // Moves the current file to the last file, and recreates the current file. |
53 // | 53 // |
54 // NOTE: this is invoked before every command, and does nothing if we've | 54 // NOTE: this is invoked before every command, and does nothing if we've |
55 // already Init'ed. | 55 // already Init'ed. |
56 void Init(); | 56 void Init(); |
57 bool inited() const { return inited_; } | 57 bool inited() const { return inited_; } |
58 | 58 |
59 // Appends the specified commands to the current file. If reset_first is | 59 // Appends the specified commands to the current file. If reset_first is |
60 // true the the current file is recreated. | 60 // true the the current file is recreated. |
61 // | 61 void AppendCommands(ScopedVector<SessionCommand> commands, bool reset_first); |
62 // NOTE: this deletes SessionCommands in commands as well as the supplied | |
63 // vector. | |
64 void AppendCommands(ScopedVector<SessionCommand>* commands, bool reset_first); | |
65 | 62 |
66 // Invoked from the service to read the commands that make up the last | 63 // Invoked from the service to read the commands that make up the last |
67 // session, invokes ReadLastSessionCommandsImpl to do the work. | 64 // session, invokes ReadLastSessionCommandsImpl to do the work. |
68 void ReadLastSessionCommands( | 65 void ReadLastSessionCommands( |
69 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, | 66 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, |
70 const BaseSessionService::InternalGetCommandsCallback& callback); | 67 const BaseSessionService::InternalGetCommandsCallback& callback); |
71 | 68 |
72 // Reads the commands from the last file. | 69 // Reads the commands from the last file. |
73 // | 70 // |
74 // On success, the read commands are added to commands. | 71 // On success, the read commands are added to commands. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Main thread, all others on the IO thread, hence lazy initialization. | 127 // Main thread, all others on the IO thread, hence lazy initialization. |
131 bool inited_; | 128 bool inited_; |
132 | 129 |
133 // If true, the file is empty (no commands have been added to it). | 130 // If true, the file is empty (no commands have been added to it). |
134 bool empty_file_; | 131 bool empty_file_; |
135 | 132 |
136 DISALLOW_COPY_AND_ASSIGN(SessionBackend); | 133 DISALLOW_COPY_AND_ASSIGN(SessionBackend); |
137 }; | 134 }; |
138 | 135 |
139 #endif // CHROME_BROWSER_SESSIONS_SESSION_BACKEND_H_ | 136 #endif // CHROME_BROWSER_SESSIONS_SESSION_BACKEND_H_ |
OLD | NEW |