OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/background_fetch/background_fetch_job_response_data.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 BackgroundFetchJobResponseData::BackgroundFetchJobResponseData( |
| 10 size_t num_requests, |
| 11 const BackgroundFetchResponseCompleteCallback& completion_callback) |
| 12 : blobs_(num_requests), |
| 13 num_requests_(num_requests), |
| 14 completion_callback_(std::move(completion_callback)) {} |
| 15 |
| 16 BackgroundFetchJobResponseData::~BackgroundFetchJobResponseData() {} |
| 17 |
| 18 void BackgroundFetchJobResponseData::AddResponse( |
| 19 int request_num, |
| 20 std::unique_ptr<BlobHandle> response) { |
| 21 blobs_[request_num] = std::move(response); |
| 22 completed_requests_++; |
| 23 |
| 24 if (completed_requests_ == num_requests_) { |
| 25 std::move(completion_callback_).Run(std::move(blobs_)); |
| 26 } |
| 27 } |
| 28 |
| 29 bool BackgroundFetchJobResponseData::IsComplete() { |
| 30 return completed_requests_ == num_requests_; |
| 31 } |
| 32 |
| 33 } // namespace content |
OLD | NEW |