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/safe_browsing/safe_browsing_store_file.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 } | 568 } |
569 | 569 |
570 SafeBrowsingStoreFile::~SafeBrowsingStoreFile() { | 570 SafeBrowsingStoreFile::~SafeBrowsingStoreFile() { |
571 // Thread-checking is disabled in the destructor due to crbug.com/338486. | 571 // Thread-checking is disabled in the destructor due to crbug.com/338486. |
572 task_runner_ = nullptr; | 572 task_runner_ = nullptr; |
573 | 573 |
574 Close(); | 574 Close(); |
575 } | 575 } |
576 | 576 |
577 bool SafeBrowsingStoreFile::CalledOnValidThread() { | 577 bool SafeBrowsingStoreFile::CalledOnValidThread() { |
578 return !task_runner_ || task_runner_->RunsTasksOnCurrentThread(); | 578 return !task_runner_ || task_runner_->RunsTasksInCurrentSequence(); |
579 } | 579 } |
580 | 580 |
581 bool SafeBrowsingStoreFile::Delete() { | 581 bool SafeBrowsingStoreFile::Delete() { |
582 DCHECK(CalledOnValidThread()); | 582 DCHECK(CalledOnValidThread()); |
583 | 583 |
584 // The database should not be open at this point. But, just in | 584 // The database should not be open at this point. But, just in |
585 // case, close everything before deleting. | 585 // case, close everything before deleting. |
586 if (!Close()) { | 586 if (!Close()) { |
587 NOTREACHED(); | 587 NOTREACHED(); |
588 return false; | 588 return false; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 // also removed. | 1163 // also removed. |
1164 const base::FilePath journal_filename( | 1164 const base::FilePath journal_filename( |
1165 basename.value() + FILE_PATH_LITERAL("-journal")); | 1165 basename.value() + FILE_PATH_LITERAL("-journal")); |
1166 if (base::PathExists(journal_filename)) | 1166 if (base::PathExists(journal_filename)) |
1167 base::DeleteFile(journal_filename, false); | 1167 base::DeleteFile(journal_filename, false); |
1168 | 1168 |
1169 return true; | 1169 return true; |
1170 } | 1170 } |
1171 | 1171 |
1172 } // namespace safe_browsing | 1172 } // namespace safe_browsing |
OLD | NEW |