OLD | NEW |
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_BASE_SESSION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ |
6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ | 6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/task/cancelable_task_tracker.h" |
16 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
17 #include "chrome/browser/common/cancelable_request.h" | 18 #include "chrome/browser/common/cancelable_request.h" |
18 #include "chrome/browser/sessions/session_id.h" | 19 #include "chrome/browser/sessions/session_id.h" |
19 #include "chrome/common/cancelable_task_tracker.h" | |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 class Profile; | 22 class Profile; |
23 class SessionBackend; | 23 class SessionBackend; |
24 class SessionCommand; | 24 class SessionCommand; |
25 | 25 |
26 namespace sessions { | 26 namespace sessions { |
27 class SerializedNavigationEntry; | 27 class SerializedNavigationEntry; |
28 } | 28 } |
29 | 29 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const SessionCommand& command, | 144 const SessionCommand& command, |
145 SessionID::id_type* window_id, | 145 SessionID::id_type* window_id, |
146 std::string* app_name); | 146 std::string* app_name); |
147 | 147 |
148 // Returns true if the entry at specified |url| should be written to disk. | 148 // Returns true if the entry at specified |url| should be written to disk. |
149 bool ShouldTrackEntry(const GURL& url); | 149 bool ShouldTrackEntry(const GURL& url); |
150 | 150 |
151 // Invokes SessionBackend::ReadLastSessionCommands with callback on the | 151 // Invokes SessionBackend::ReadLastSessionCommands with callback on the |
152 // backend thread. | 152 // backend thread. |
153 // If testing, SessionBackend::ReadLastSessionCommands is invoked directly. | 153 // If testing, SessionBackend::ReadLastSessionCommands is invoked directly. |
154 CancelableTaskTracker::TaskId ScheduleGetLastSessionCommands( | 154 base::CancelableTaskTracker::TaskId ScheduleGetLastSessionCommands( |
155 const InternalGetCommandsCallback& callback, | 155 const InternalGetCommandsCallback& callback, |
156 CancelableTaskTracker* tracker); | 156 base::CancelableTaskTracker* tracker); |
157 | 157 |
158 // This posts the task to the SequencedWorkerPool, or run immediately | 158 // This posts the task to the SequencedWorkerPool, or run immediately |
159 // if the SequencedWorkerPool has been shutdown. | 159 // if the SequencedWorkerPool has been shutdown. |
160 bool RunTaskOnBackendThread(const tracked_objects::Location& from_here, | 160 bool RunTaskOnBackendThread(const tracked_objects::Location& from_here, |
161 const base::Closure& task); | 161 const base::Closure& task); |
162 | 162 |
163 // Max number of navigation entries in each direction we'll persist. | 163 // Max number of navigation entries in each direction we'll persist. |
164 static const int max_persist_navigation_count; | 164 static const int max_persist_navigation_count; |
165 | 165 |
166 private: | 166 private: |
(...skipping 18 matching lines...) Expand all Loading... |
185 // The number of commands sent to the backend before doing a reset. | 185 // The number of commands sent to the backend before doing a reset. |
186 int commands_since_reset_; | 186 int commands_since_reset_; |
187 | 187 |
188 // A token to make sure that all tasks will be serialized. | 188 // A token to make sure that all tasks will be serialized. |
189 base::SequencedWorkerPool::SequenceToken sequence_token_; | 189 base::SequencedWorkerPool::SequenceToken sequence_token_; |
190 | 190 |
191 DISALLOW_COPY_AND_ASSIGN(BaseSessionService); | 191 DISALLOW_COPY_AND_ASSIGN(BaseSessionService); |
192 }; | 192 }; |
193 | 193 |
194 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ | 194 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ |
OLD | NEW |