| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 current_task_runner->PostTask(FROM_HERE, db_updated_callback_); | 135 current_task_runner->PostTask(FROM_HERE, db_updated_callback_); |
| 136 db_updated_callback_.Reset(); | 136 db_updated_callback_.Reset(); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 void V4Database::UpdatedStoreReady(ListIdentifier identifier, | 140 void V4Database::UpdatedStoreReady(ListIdentifier identifier, |
| 141 std::unique_ptr<V4Store> new_store) { | 141 std::unique_ptr<V4Store> new_store) { |
| 142 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 142 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 143 DCHECK(pending_store_updates_); | 143 DCHECK(pending_store_updates_); |
| 144 if (new_store) { | 144 if (new_store) { |
| 145 (*store_map_)[identifier] = std::move(new_store); | 145 (*store_map_)[identifier].swap(new_store); |
| 146 // |new_store| now is the store that needs to be destroyed on task runner. |
| 147 V4Store::Destroy(std::move(new_store)); |
| 146 } | 148 } |
| 147 | 149 |
| 148 pending_store_updates_--; | 150 pending_store_updates_--; |
| 149 if (!pending_store_updates_) { | 151 if (!pending_store_updates_) { |
| 150 db_updated_callback_.Run(); | 152 db_updated_callback_.Run(); |
| 151 db_updated_callback_.Reset(); | 153 db_updated_callback_.Reset(); |
| 152 } | 154 } |
| 153 } | 155 } |
| 154 | 156 |
| 155 std::unique_ptr<StoreStateMap> V4Database::GetStoreStateMap() { | 157 std::unique_ptr<StoreStateMap> V4Database::GetStoreStateMap() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 filename_(filename), | 222 filename_(filename), |
| 221 list_id_(list_id), | 223 list_id_(list_id), |
| 222 sb_threat_type_(sb_threat_type) { | 224 sb_threat_type_(sb_threat_type) { |
| 223 DCHECK(!fetch_updates_ || !filename_.empty()); | 225 DCHECK(!fetch_updates_ || !filename_.empty()); |
| 224 DCHECK_NE(SB_THREAT_TYPE_SAFE, sb_threat_type_); | 226 DCHECK_NE(SB_THREAT_TYPE_SAFE, sb_threat_type_); |
| 225 } | 227 } |
| 226 | 228 |
| 227 ListInfo::~ListInfo() {} | 229 ListInfo::~ListInfo() {} |
| 228 | 230 |
| 229 } // namespace safe_browsing | 231 } // namespace safe_browsing |
| OLD | NEW |