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

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

Issue 500143002: Fixes possible use after free in SessionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweak Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sessions/base_session_service.cc » ('j') | no next file with comments »
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_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"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 // Invokes SessionBackend::ReadLastSessionCommands with callback on the 150 // Invokes SessionBackend::ReadLastSessionCommands with callback on the
151 // backend thread. 151 // backend thread.
152 // If testing, SessionBackend::ReadLastSessionCommands is invoked directly. 152 // If testing, SessionBackend::ReadLastSessionCommands is invoked directly.
153 base::CancelableTaskTracker::TaskId ScheduleGetLastSessionCommands( 153 base::CancelableTaskTracker::TaskId ScheduleGetLastSessionCommands(
154 const InternalGetCommandsCallback& callback, 154 const InternalGetCommandsCallback& callback,
155 base::CancelableTaskTracker* tracker); 155 base::CancelableTaskTracker* tracker);
156 156
157 // This posts the task to the SequencedWorkerPool, or run immediately 157 // This posts the task to the SequencedWorkerPool, or run immediately
158 // if the SequencedWorkerPool has been shutdown. 158 // if the SequencedWorkerPool has been shutdown.
159 bool RunTaskOnBackendThread(const tracked_objects::Location& from_here, 159 void RunTaskOnBackendThread(const tracked_objects::Location& from_here,
160 const base::Closure& task); 160 const base::Closure& task);
161 161
162 // Max number of navigation entries in each direction we'll persist. 162 // Max number of navigation entries in each direction we'll persist.
163 static const int max_persist_navigation_count; 163 static const int max_persist_navigation_count;
164 164
165 private: 165 private:
166 friend class BetterSessionRestoreCrashTest; 166 friend class BetterSessionRestoreCrashTest;
167 friend class SessionServiceTestHelper;
marja 2014/08/26 14:48:09 Afaics this is not needed.
167 168
168 // The profile. This may be null during testing. 169 // The profile. This may be null during testing.
169 Profile* profile_; 170 Profile* profile_;
170 171
171 // The backend. 172 // The backend.
172 scoped_refptr<SessionBackend> backend_; 173 scoped_refptr<SessionBackend> backend_;
173 174
174 // Used to invoke Save. 175 // Used to invoke Save.
175 base::WeakPtrFactory<BaseSessionService> weak_factory_; 176 base::WeakPtrFactory<BaseSessionService> weak_factory_;
176 177
177 // Commands we need to send over to the backend. 178 // Commands we need to send over to the backend.
178 std::vector<SessionCommand*> pending_commands_; 179 std::vector<SessionCommand*> pending_commands_;
179 180
180 // Whether the backend file should be recreated the next time we send 181 // Whether the backend file should be recreated the next time we send
181 // over the commands. 182 // over the commands.
182 bool pending_reset_; 183 bool pending_reset_;
183 184
184 // 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.
185 int commands_since_reset_; 186 int commands_since_reset_;
186 187
187 // A token to make sure that all tasks will be serialized. 188 // A token to make sure that all tasks will be serialized.
188 base::SequencedWorkerPool::SequenceToken sequence_token_; 189 base::SequencedWorkerPool::SequenceToken sequence_token_;
189 190
190 DISALLOW_COPY_AND_ASSIGN(BaseSessionService); 191 DISALLOW_COPY_AND_ASSIGN(BaseSessionService);
191 }; 192 };
192 193
193 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ 194 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sessions/base_session_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698