OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/background_fetch/background_fetch_job_data.h" | 5 #include "content/browser/background_fetch/background_fetch_job_data.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "content/browser/background_fetch/background_fetch_job_info.h" | 8 #include "content/browser/background_fetch/background_fetch_job_info.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 BackgroundFetchJobData::BackgroundFetchJobData( | 12 BackgroundFetchJobData::BackgroundFetchJobData( |
13 BackgroundFetchRequestInfos request_infos) | 13 BackgroundFetchRequestInfos& request_infos) |
14 : request_infos_(std::move(request_infos)) {} | 14 : request_infos_(request_infos) {} |
15 | 15 |
16 BackgroundFetchJobData::~BackgroundFetchJobData() {} | 16 BackgroundFetchJobData::~BackgroundFetchJobData() {} |
17 | 17 |
18 // TODO(harkness): Provide more detail about status and where the returned data | 18 // TODO(harkness): Provide more detail about status and where the returned data |
19 // is now available. | 19 // is now available. |
20 bool BackgroundFetchJobData::BackgroundFetchRequestInfoComplete( | 20 bool BackgroundFetchJobData::BackgroundFetchRequestInfoComplete( |
21 const std::string& fetch_guid) { | 21 const std::string& fetch_guid) { |
22 // Make sure that the request was expected to be in-progress. | 22 // Make sure that the request was expected to be in-progress. |
23 auto index_iter = request_info_index_.find(fetch_guid); | 23 auto index_iter = request_info_index_.find(fetch_guid); |
24 DCHECK(index_iter != request_info_index_.end()); | 24 DCHECK(index_iter != request_info_index_.end()); |
(...skipping 23 matching lines...) Expand all Loading... |
48 bool BackgroundFetchJobData::IsComplete() const { | 48 bool BackgroundFetchJobData::IsComplete() const { |
49 return ((next_request_info_ == request_infos_.size()) && | 49 return ((next_request_info_ == request_infos_.size()) && |
50 request_info_index_.empty()); | 50 request_info_index_.empty()); |
51 } | 51 } |
52 | 52 |
53 bool BackgroundFetchJobData::HasRequestsRemaining() const { | 53 bool BackgroundFetchJobData::HasRequestsRemaining() const { |
54 return next_request_info_ != request_infos_.size(); | 54 return next_request_info_ != request_infos_.size(); |
55 } | 55 } |
56 | 56 |
57 } // namespace content | 57 } // namespace content |
OLD | NEW |