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

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

Issue 2767373002: Implement GetJobResponse and merge JobData into DataManager. (Closed)
Patch Set: Removed typedef and added DISALLOW_COPY_AND_ASSIGN Created 3 years, 8 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 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback.h"
13 #include "base/callback_forward.h"
14 #include "base/macros.h"
15 #include "content/public/browser/blob_handle.h"
16
17 namespace content {
18
19 using BackgroundFetchResponseCompleteCallback =
20 base::Callback<void(std::vector<std::unique_ptr<BlobHandle>>)>;
21
22 // Temporary holding class to aggregate the response data for requests
23 // associated with a given BackgroundFetch job.
24 class BackgroundFetchJobResponseData {
25 public:
26 BackgroundFetchJobResponseData(
27 size_t num_requests,
28 const BackgroundFetchResponseCompleteCallback& completion_callback);
29 ~BackgroundFetchJobResponseData();
30
31 void AddResponse(int request_num, std::unique_ptr<BlobHandle> response);
32 bool IsComplete();
33
34 private:
35 std::vector<std::unique_ptr<BlobHandle>> blobs_;
36 size_t num_requests_ = 0;
37 size_t completed_requests_ = 0;
38 const std::string job_guid_;
39 BackgroundFetchResponseCompleteCallback completion_callback_;
40
41 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobResponseData);
42 };
43
44 } // namespace content
45
46 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698