Chromium Code Reviews| Index: content/browser/background_fetch/background_fetch_job_response_data.h |
| diff --git a/content/browser/background_fetch/background_fetch_job_response_data.h b/content/browser/background_fetch/background_fetch_job_response_data.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ac2c2514d8dcd0c4e3bf1a4257af36b72082cdc5 |
| --- /dev/null |
| +++ b/content/browser/background_fetch/background_fetch_job_response_data.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_ |
| +#define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_ |
| + |
| +#include <memory> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "base/callback_forward.h" |
| +#include "content/public/browser/blob_handle.h" |
| + |
| +namespace content { |
| + |
| +using BackgroundFetchResponseCompleteCallback = |
| + base::Callback<void(std::vector<std::unique_ptr<BlobHandle>>)>; |
| + |
| +// Temporary holding class to aggregate the response data for requests |
| +// associated with a given BackgroundFetch job. |
| +class BackgroundFetchJobResponseData { |
| + public: |
| + BackgroundFetchJobResponseData( |
| + size_t num_requests, |
| + const BackgroundFetchResponseCompleteCallback& completion_callback); |
| + ~BackgroundFetchJobResponseData(); |
| + |
| + void AddResponse(int request_num, std::unique_ptr<BlobHandle> response); |
| + bool IsComplete(); |
| + |
| + private: |
| + std::vector<std::unique_ptr<BlobHandle>> blobs_; |
| + size_t num_requests_ = 0; |
| + size_t completed_requests_ = 0; |
| + const std::string job_guid_; |
| + BackgroundFetchResponseCompleteCallback completion_callback_; |
| +}; |
|
Peter Beverloo
2017/03/27 10:01:14
DISALLOW_COPY_AND_ASSIGN
harkness
2017/03/27 11:47:49
Done.
|
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_ |