| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/precache/core/precache_fetcher.h" | 5 #include "components/precache/core/precache_fetcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 if (unfinished_work_->has_config_settings()) { | 479 if (unfinished_work_->has_config_settings()) { |
| 480 // If config fetch is incomplete, |top_hosts_to_fetch_| will be empty and | 480 // If config fetch is incomplete, |top_hosts_to_fetch_| will be empty and |
| 481 // top hosts should be left as is in |unfinished_work_|. | 481 // top hosts should be left as is in |unfinished_work_|. |
| 482 unfinished_work_->clear_top_host(); | 482 unfinished_work_->clear_top_host(); |
| 483 for (const auto& top_host : top_hosts_fetching_) | 483 for (const auto& top_host : top_hosts_fetching_) |
| 484 unfinished_work_->add_top_host()->set_hostname(top_host.hostname); | 484 unfinished_work_->add_top_host()->set_hostname(top_host.hostname); |
| 485 for (const auto& top_host : top_hosts_to_fetch_) | 485 for (const auto& top_host : top_hosts_to_fetch_) |
| 486 unfinished_work_->add_top_host()->set_hostname(top_host.hostname); | 486 unfinished_work_->add_top_host()->set_hostname(top_host.hostname); |
| 487 } | 487 } |
| 488 for (const auto& resource : resources_fetching_) { | 488 for (const auto& resource : resources_fetching_) { |
| 489 auto new_resource = unfinished_work_->add_resource(); | 489 auto* new_resource = unfinished_work_->add_resource(); |
| 490 new_resource->set_url(resource.url.spec()); | 490 new_resource->set_url(resource.url.spec()); |
| 491 new_resource->set_top_host_name(resource.referrer); | 491 new_resource->set_top_host_name(resource.referrer); |
| 492 } | 492 } |
| 493 for (const auto& resource : resources_to_fetch_) { | 493 for (const auto& resource : resources_to_fetch_) { |
| 494 auto new_resource = unfinished_work_->add_resource(); | 494 auto* new_resource = unfinished_work_->add_resource(); |
| 495 new_resource->set_url(resource.url.spec()); | 495 new_resource->set_url(resource.url.spec()); |
| 496 new_resource->set_top_host_name(resource.referrer); | 496 new_resource->set_top_host_name(resource.referrer); |
| 497 } | 497 } |
| 498 top_hosts_fetching_.clear(); | 498 top_hosts_fetching_.clear(); |
| 499 top_hosts_to_fetch_.clear(); | 499 top_hosts_to_fetch_.clear(); |
| 500 resources_fetching_.clear(); | 500 resources_fetching_.clear(); |
| 501 resources_to_fetch_.clear(); | 501 resources_to_fetch_.clear(); |
| 502 pool_.DeleteAll(); | 502 pool_.DeleteAll(); |
| 503 return std::move(unfinished_work_); | 503 return std::move(unfinished_work_); |
| 504 } | 504 } |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 remaining = 0; | 843 remaining = 0; |
| 844 quota_.set_remaining( | 844 quota_.set_remaining( |
| 845 used_bytes > quota_.remaining() ? 0U : quota_.remaining() - used_bytes); | 845 used_bytes > quota_.remaining() ? 0U : quota_.remaining() - used_bytes); |
| 846 db_task_runner_->PostTask( | 846 db_task_runner_->PostTask( |
| 847 FROM_HERE, | 847 FROM_HERE, |
| 848 base::Bind(&PrecacheDatabase::SaveQuota, precache_database_, quota_)); | 848 base::Bind(&PrecacheDatabase::SaveQuota, precache_database_, quota_)); |
| 849 } | 849 } |
| 850 } | 850 } |
| 851 | 851 |
| 852 } // namespace precache | 852 } // namespace precache |
| OLD | NEW |