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

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

Issue 2774263003: Added ServiceWorkerResponses to GetJobResponse callback (Closed)
Patch Set: Rebase to pull in BackgroundFetchRegistrationId patch 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
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 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_ 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_ 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/memory/ptr_util.h"
15 #include "content/common/service_worker/service_worker_types.h"
14 #include "content/public/browser/blob_handle.h" 16 #include "content/public/browser/blob_handle.h"
15 17
16 namespace content { 18 namespace content {
17 19
20 class BackgroundFetchRequestInfo;
21
18 using BackgroundFetchResponseCompleteCallback = 22 using BackgroundFetchResponseCompleteCallback =
19 base::Callback<void(std::vector<std::unique_ptr<BlobHandle>>)>; 23 base::Callback<void(std::vector<ServiceWorkerResponse>,
24 std::vector<std::unique_ptr<BlobHandle>>)>;
20 25
21 // Temporary holding class to aggregate the response data for requests 26 // Temporary holding class to aggregate the response data for requests
22 // associated with a given BackgroundFetch job. 27 // associated with a given BackgroundFetch job.
23 class BackgroundFetchJobResponseData { 28 class BackgroundFetchJobResponseData {
24 public: 29 public:
25 BackgroundFetchJobResponseData( 30 BackgroundFetchJobResponseData(
26 size_t num_requests, 31 size_t num_requests,
27 const BackgroundFetchResponseCompleteCallback& completion_callback); 32 const BackgroundFetchResponseCompleteCallback& completion_callback);
28 ~BackgroundFetchJobResponseData(); 33 ~BackgroundFetchJobResponseData();
29 34
30 void AddResponse(int request_num, std::unique_ptr<BlobHandle> response); 35 void AddResponse(const BackgroundFetchRequestInfo& request_info,
36 std::unique_ptr<BlobHandle> response);
31 bool IsComplete(); 37 bool IsComplete();
32 38
33 private: 39 private:
34 std::vector<std::unique_ptr<BlobHandle>> blobs_; 40 std::vector<std::unique_ptr<BlobHandle>> blobs_;
41 std::vector<ServiceWorkerResponse> responses_;
35 size_t num_requests_ = 0; 42 size_t num_requests_ = 0;
36 size_t completed_requests_ = 0; 43 size_t completed_requests_ = 0;
37 const std::string job_guid_; 44 const std::string job_guid_;
38 BackgroundFetchResponseCompleteCallback completion_callback_; 45 BackgroundFetchResponseCompleteCallback completion_callback_;
39 }; 46 };
40 47
41 } // namespace content 48 } // namespace content
42 49
43 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H _ 50 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698