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 "components/ntp_snippets/remote/remote_suggestions_database.h" | 5 #include "components/ntp_snippets/remote/remote_suggestions_database.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "components/leveldb_proto/proto_database_impl.h" | 11 #include "components/leveldb_proto/proto_database_impl.h" |
11 #include "components/ntp_snippets/remote/proto/ntp_snippets.pb.h" | 12 #include "components/ntp_snippets/remote/proto/ntp_snippets.pb.h" |
12 | 13 |
13 using leveldb_proto::ProtoDatabaseImpl; | 14 using leveldb_proto::ProtoDatabaseImpl; |
14 | 15 |
15 namespace { | 16 namespace { |
16 // Statistics are logged to UMA with this string as part of histogram name. They | 17 // Statistics are logged to UMA with this string as part of histogram name. They |
17 // can all be found under LevelDB.*.NTPSnippets. Changing this needs to | 18 // can all be found under LevelDB.*.NTPSnippets. Changing this needs to |
18 // synchronize with histograms.xml, AND will also become incompatible with older | 19 // synchronize with histograms.xml, AND will also become incompatible with older |
19 // browsers still reporting the previous values. | 20 // browsers still reporting the previous values. |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 auto keys_to_remove = base::MakeUnique<std::vector<std::string>>(); | 327 auto keys_to_remove = base::MakeUnique<std::vector<std::string>>(); |
327 for (const std::string& key : *image_keys) { | 328 for (const std::string& key : *image_keys) { |
328 if (references->count(key) == 0) { | 329 if (references->count(key) == 0) { |
329 keys_to_remove->emplace_back(key); | 330 keys_to_remove->emplace_back(key); |
330 } | 331 } |
331 } | 332 } |
332 DeleteImages(std::move(keys_to_remove)); | 333 DeleteImages(std::move(keys_to_remove)); |
333 } | 334 } |
334 | 335 |
335 } // namespace ntp_snippets | 336 } // namespace ntp_snippets |
OLD | NEW |