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

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

Issue 500143002: Fixes possible use after free in SessionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove friend 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
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 #include "chrome/browser/sessions/base_session_service.h" 5 #include "chrome/browser/sessions/base_session_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 base::Bind(&PostOrRunInternalGetCommandsCallback, 287 base::Bind(&PostOrRunInternalGetCommandsCallback,
288 base::MessageLoopProxy::current(), run_if_not_canceled); 288 base::MessageLoopProxy::current(), run_if_not_canceled);
289 289
290 RunTaskOnBackendThread( 290 RunTaskOnBackendThread(
291 FROM_HERE, 291 FROM_HERE,
292 base::Bind(&SessionBackend::ReadLastSessionCommands, backend(), 292 base::Bind(&SessionBackend::ReadLastSessionCommands, backend(),
293 is_canceled, callback_runner)); 293 is_canceled, callback_runner));
294 return id; 294 return id;
295 } 295 }
296 296
297 bool BaseSessionService::RunTaskOnBackendThread( 297 void BaseSessionService::RunTaskOnBackendThread(
298 const tracked_objects::Location& from_here, 298 const tracked_objects::Location& from_here,
299 const base::Closure& task) { 299 const base::Closure& task) {
300 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 300 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
301 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); 301 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
302 if (!pool->IsShutdownInProgress()) { 302 if (!pool->IsShutdownInProgress()) {
303 return pool->PostSequencedWorkerTask(sequence_token_, 303 pool->PostSequencedWorkerTask(sequence_token_, from_here, task);
304 from_here,
305 task);
306 } else { 304 } else {
307 // Fall back to executing on the main thread if the sequence 305 // Fall back to executing on the main thread if the sequence
308 // worker pool has been requested to shutdown (around shutdown 306 // worker pool has been requested to shutdown (around shutdown
309 // time). 307 // time).
310 task.Run(); 308 task.Run();
311 return true;
312 } 309 }
313 } 310 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/base_session_service.h ('k') | chrome/browser/sessions/session_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698