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/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 id_(id), | 267 id_(id), |
268 history_dir_(history_dir), | 268 history_dir_(history_dir), |
269 ALLOW_THIS_IN_INITIALIZER_LIST(expirer_(this, bookmark_service)), | 269 ALLOW_THIS_IN_INITIALIZER_LIST(expirer_(this, bookmark_service)), |
270 recent_redirects_(kMaxRedirectCount), | 270 recent_redirects_(kMaxRedirectCount), |
271 backend_destroy_message_loop_(NULL), | 271 backend_destroy_message_loop_(NULL), |
272 segment_queried_(false), | 272 segment_queried_(false), |
273 bookmark_service_(bookmark_service) { | 273 bookmark_service_(bookmark_service) { |
274 } | 274 } |
275 | 275 |
276 HistoryBackend::~HistoryBackend() { | 276 HistoryBackend::~HistoryBackend() { |
277 DCHECK(!scheduled_commit_) << "Deleting without cleanup"; | 277 DCHECK(!scheduled_commit_.get()) << "Deleting without cleanup"; |
278 ReleaseDBTasks(); | 278 ReleaseDBTasks(); |
279 | 279 |
280 #if defined(OS_ANDROID) | 280 #if defined(OS_ANDROID) |
281 // Release AndroidProviderBackend before other objects. | 281 // Release AndroidProviderBackend before other objects. |
282 android_provider_backend_.reset(); | 282 android_provider_backend_.reset(); |
283 #endif | 283 #endif |
284 | 284 |
285 // First close the databases before optionally running the "destroy" task. | 285 // First close the databases before optionally running the "destroy" task. |
286 CloseAllDatabases(); | 286 CloseAllDatabases(); |
287 | 287 |
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 if (scheduled_commit_.get()) | 2554 if (scheduled_commit_.get()) |
2555 return; | 2555 return; |
2556 scheduled_commit_ = new CommitLaterTask(this); | 2556 scheduled_commit_ = new CommitLaterTask(this); |
2557 MessageLoop::current()->PostDelayedTask( | 2557 MessageLoop::current()->PostDelayedTask( |
2558 FROM_HERE, | 2558 FROM_HERE, |
2559 base::Bind(&CommitLaterTask::RunCommit, scheduled_commit_.get()), | 2559 base::Bind(&CommitLaterTask::RunCommit, scheduled_commit_.get()), |
2560 base::TimeDelta::FromSeconds(kCommitIntervalSeconds)); | 2560 base::TimeDelta::FromSeconds(kCommitIntervalSeconds)); |
2561 } | 2561 } |
2562 | 2562 |
2563 void HistoryBackend::CancelScheduledCommit() { | 2563 void HistoryBackend::CancelScheduledCommit() { |
2564 if (scheduled_commit_) { | 2564 if (scheduled_commit_.get()) { |
2565 scheduled_commit_->Cancel(); | 2565 scheduled_commit_->Cancel(); |
2566 scheduled_commit_ = NULL; | 2566 scheduled_commit_ = NULL; |
2567 } | 2567 } |
2568 } | 2568 } |
2569 | 2569 |
2570 void HistoryBackend::ProcessDBTaskImpl() { | 2570 void HistoryBackend::ProcessDBTaskImpl() { |
2571 if (!db_.get()) { | 2571 if (!db_.get()) { |
2572 // db went away, release all the refs. | 2572 // db went away, release all the refs. |
2573 ReleaseDBTasks(); | 2573 ReleaseDBTasks(); |
2574 return; | 2574 return; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2926 info.url_id = visit.url_id; | 2926 info.url_id = visit.url_id; |
2927 info.time = visit.visit_time; | 2927 info.time = visit.visit_time; |
2928 info.transition = visit.transition; | 2928 info.transition = visit.transition; |
2929 // If we don't have a delegate yet during setup or shutdown, we will drop | 2929 // If we don't have a delegate yet during setup or shutdown, we will drop |
2930 // these notifications. | 2930 // these notifications. |
2931 if (delegate_.get()) | 2931 if (delegate_.get()) |
2932 delegate_->NotifyVisitDBObserversOnAddVisit(info); | 2932 delegate_->NotifyVisitDBObserversOnAddVisit(info); |
2933 } | 2933 } |
2934 | 2934 |
2935 } // namespace history | 2935 } // namespace history |
OLD | NEW |