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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
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..107707cb42e5682a4d68dd1af6118fb76fba71ab
--- /dev/null
+++ b/content/browser/background_fetch/background_fetch_job_response_data.h
@@ -0,0 +1,46 @@
+// 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 "base/macros.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_;
+
+ DISALLOW_COPY_AND_ASSIGN(BackgroundFetchJobResponseData);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_JOB_RESPONSE_DATA_H_

Powered by Google App Engine
This is Rietveld 408576698