Chromium Code Reviews| Index: components/safe_browsing_db/v4_database.cc |
| diff --git a/components/safe_browsing_db/v4_database.cc b/components/safe_browsing_db/v4_database.cc |
| index 22533e1f275e46c205eb33535f17036160ea7047..0aa3849368d7fc8ddfd40aa64888c956d0b5291b 100644 |
| --- a/components/safe_browsing_db/v4_database.cc |
| +++ b/components/safe_browsing_db/v4_database.cc |
| @@ -92,8 +92,9 @@ V4Database::~V4Database() { |
| DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); |
| } |
| -void V4Database::ApplyUpdate(const std::vector<ListUpdateResponse>& responses, |
| - DatabaseUpdatedCallback db_updated_callback) { |
| +void V4Database::ApplyUpdate( |
| + std::unique_ptr<ParsedServerResponse> parsed_server_response, |
| + DatabaseUpdatedCallback db_updated_callback) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| DCHECK(!pending_store_updates_); |
| DCHECK(db_updated_callback_.is_null()); |
| @@ -104,12 +105,13 @@ void V4Database::ApplyUpdate(const std::vector<ListUpdateResponse>& responses, |
| // current thread. |
| const scoped_refptr<base::SingleThreadTaskRunner>& current_task_runner = |
| base::MessageLoop::current()->task_runner(); |
| - for (const ListUpdateResponse& response : responses) { |
| - UpdateListIdentifier identifier(response); |
| + for (std::unique_ptr<ListUpdateResponse>& response : |
|
Scott Hess - ex-Googler
2016/06/28 03:58:43
I'm not entirely comfortable with the non-const &,
Nathan Parker
2016/06/28 19:00:37
I think for(..:..) loops by default copy the eleme
vakh (use Gerrit instead)
2016/06/28 21:34:14
Removing the "&" also leads to a compile-time erro
vakh (use Gerrit instead)
2016/06/28 21:34:14
1. Adding constness leads to a compile-time error:
Scott Hess - ex-Googler
2016/06/28 22:22:25
Apologies - that's expected, because you need to m
vakh (use Gerrit instead)
2016/06/29 19:58:52
I am going ahead with the current implementation f
Scott Hess - ex-Googler
2016/06/29 20:15:58
Acknowledged. I wonder where we'd be if move sema
|
| + *parsed_server_response) { |
| + UpdateListIdentifier identifier(response.get()); |
| StoreMap::const_iterator iter = store_map_->find(identifier); |
| if (iter != store_map_->end()) { |
| const std::unique_ptr<V4Store>& old_store = iter->second; |
| - if (old_store->state() != response.new_client_state()) { |
| + if (old_store->state() != response->new_client_state()) { |
| // A different state implies there are updates to process. |
| pending_store_updates_++; |
| UpdatedStoreReadyCallback store_ready_callback = base::Bind( |
| @@ -117,7 +119,8 @@ void V4Database::ApplyUpdate(const std::vector<ListUpdateResponse>& responses, |
| db_task_runner_->PostTask( |
| FROM_HERE, |
| base::Bind(&V4Store::ApplyUpdate, base::Unretained(old_store.get()), |
| - response, current_task_runner, store_ready_callback)); |
| + base::Passed(std::move(response)), current_task_runner, |
| + store_ready_callback)); |
| } |
| } else { |
| NOTREACHED() << "Got update for unexpected identifier: " << identifier; |