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 #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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // backend. | 69 // backend. |
70 static const int kSaveDelayMS = 2500; | 70 static const int kSaveDelayMS = 2500; |
71 | 71 |
72 // static | 72 // static |
73 const int BaseSessionService::max_persist_navigation_count = 6; | 73 const int BaseSessionService::max_persist_navigation_count = 6; |
74 | 74 |
75 BaseSessionService::BaseSessionService(SessionType type, | 75 BaseSessionService::BaseSessionService(SessionType type, |
76 Profile* profile, | 76 Profile* profile, |
77 const base::FilePath& path) | 77 const base::FilePath& path) |
78 : profile_(profile), | 78 : profile_(profile), |
79 weak_factory_(this), | |
80 pending_reset_(false), | 79 pending_reset_(false), |
81 commands_since_reset_(0), | 80 commands_since_reset_(0), |
82 sequence_token_( | 81 sequence_token_( |
83 content::BrowserThread::GetBlockingPool()->GetSequenceToken()) { | 82 content::BrowserThread::GetBlockingPool()->GetSequenceToken()), |
| 83 weak_factory_(this) { |
84 if (profile) { | 84 if (profile) { |
85 // We should never be created when incognito. | 85 // We should never be created when incognito. |
86 DCHECK(!profile->IsOffTheRecord()); | 86 DCHECK(!profile->IsOffTheRecord()); |
87 } | 87 } |
88 backend_ = new SessionBackend(type, profile_ ? profile_->GetPath() : path); | 88 backend_ = new SessionBackend(type, profile_ ? profile_->GetPath() : path); |
89 DCHECK(backend_.get()); | 89 DCHECK(backend_.get()); |
90 } | 90 } |
91 | 91 |
92 BaseSessionService::~BaseSessionService() { | 92 BaseSessionService::~BaseSessionService() { |
93 } | 93 } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); | 301 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
302 if (!pool->IsShutdownInProgress()) { | 302 if (!pool->IsShutdownInProgress()) { |
303 pool->PostSequencedWorkerTask(sequence_token_, from_here, task); | 303 pool->PostSequencedWorkerTask(sequence_token_, from_here, task); |
304 } else { | 304 } else { |
305 // Fall back to executing on the main thread if the sequence | 305 // Fall back to executing on the main thread if the sequence |
306 // worker pool has been requested to shutdown (around shutdown | 306 // worker pool has been requested to shutdown (around shutdown |
307 // time). | 307 // time). |
308 task.Run(); | 308 task.Run(); |
309 } | 309 } |
310 } | 310 } |
OLD | NEW |