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

Unified Diff: content/browser/background_fetch/background_fetch_job_response_data.cc

Issue 2774263003: Added ServiceWorkerResponses to GetJobResponse callback (Closed)
Patch Set: Move PostTask to correct thread 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
« no previous file with comments | « content/browser/background_fetch/background_fetch_job_response_data.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/background_fetch/background_fetch_job_response_data.cc
diff --git a/content/browser/background_fetch/background_fetch_job_response_data.cc b/content/browser/background_fetch/background_fetch_job_response_data.cc
index 939d80a956c852beb5e9fbe3cde99eb405a06c20..d081de171eecf8ed1a9ebbe386b616c8bffa82b4 100644
--- a/content/browser/background_fetch/background_fetch_job_response_data.cc
+++ b/content/browser/background_fetch/background_fetch_job_response_data.cc
@@ -4,25 +4,43 @@
#include "content/browser/background_fetch/background_fetch_job_response_data.h"
+#include "base/time/time.h"
+#include "content/browser/background_fetch/background_fetch_request_info.h"
+#include "url/gurl.h"
+
namespace content {
BackgroundFetchJobResponseData::BackgroundFetchJobResponseData(
size_t num_requests,
const BackgroundFetchResponseCompleteCallback& completion_callback)
- : blobs_(num_requests),
- num_requests_(num_requests),
+ : num_requests_(num_requests),
completion_callback_(std::move(completion_callback)) {}
BackgroundFetchJobResponseData::~BackgroundFetchJobResponseData() {}
void BackgroundFetchJobResponseData::AddResponse(
- int request_num,
+ const BackgroundFetchRequestInfo& request_info,
std::unique_ptr<BlobHandle> response) {
- blobs_[request_num] = std::move(response);
+ auto urls = base::MakeUnique<std::vector<GURL>>(std::vector<GURL>());
+ urls->push_back(request_info.url());
+
+ // TODO(harkness): Fill in headers and status code/text.
+ auto headers = base::MakeUnique<ServiceWorkerHeaderMap>();
+ responses_.emplace_back(
+ std::move(urls), 0 /* status code */, std::string("") /* status text */,
+ blink::WebServiceWorkerResponseTypeBasic, std::move(headers),
+ response->GetUUID(), request_info.received_bytes(), GURL(),
+ blink::WebServiceWorkerResponseErrorUnknown,
+ base::Time() /* response time */, false /* is_in_cache_storage */,
+ std::string("") /* cache_storage_cache_name */,
+ base::MakeUnique<ServiceWorkerHeaderList>());
+
+ blobs_.push_back(std::move(response));
completed_requests_++;
if (completed_requests_ == num_requests_) {
- std::move(completion_callback_).Run(std::move(blobs_));
+ std::move(completion_callback_)
+ .Run(std::move(responses_), std::move(blobs_));
}
}
« no previous file with comments | « content/browser/background_fetch/background_fetch_job_response_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698