Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: content/browser/background_fetch/background_fetch_job_response_data.cc

Issue 2767373002: Implement GetJobResponse and merge JobData into DataManager. (Closed)
Patch Set: Removed typedef and added DISALLOW_COPY_AND_ASSIGN Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698