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

Unified Diff: content/browser/service_worker/service_worker_url_request_job.h

Issue 1967683003: service worker: Wait for request body blobs to finish construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/service_worker/service_worker_url_request_job.h
diff --git a/content/browser/service_worker/service_worker_url_request_job.h b/content/browser/service_worker/service_worker_url_request_job.h
index 1c164e50e30aeb3438adacc12d0179d3fd7c7e13..3fe60a1e4f436d45163265cb757703339b35745d 100644
--- a/content/browser/service_worker/service_worker_url_request_job.h
+++ b/content/browser/service_worker/service_worker_url_request_job.h
@@ -27,6 +27,7 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_status.h"
+#include "storage/common/blob_storage/blob_storage_constants.h"
#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerResponseType.h"
#include "url/gurl.h"
@@ -166,12 +167,15 @@ class CONTENT_EXPORT ServiceWorkerURLRequestJob
void MaybeStartRequest();
void StartRequest();
+ void DispatchToWorker();
+
// Creates ServiceWorkerFetchRequest from |request_| and |body_|.
std::unique_ptr<ServiceWorkerFetchRequest> CreateFetchRequest();
// Creates BlobDataHandle of the request body from |body_|. This handle
// |request_body_blob_data_handle_| will be deleted when
// ServiceWorkerURLRequestJob is deleted.
+ // This must not be called until all blobs in |body_| finished construction.
bool CreateRequestBodyBlob(std::string* blob_uuid, uint64_t* blob_size);
// For FORWARD_TO_SERVICE_WORKER case.
@@ -217,6 +221,16 @@ class CONTENT_EXPORT ServiceWorkerURLRequestJob
bool IsMainResourceLoad() const;
+ // For waiting for request body blobs to finish construction.
+ bool HasRequestBody();
+ void WaitForRequestBobyBlobsToComplete();
+ void OneRequestBodyBlobCompleted(
+ bool success,
+ storage::IPCBlobCreationCancelCode cancel_code);
+ void RequestBodyBlobsCompleted(
+ bool success,
+ storage::IPCBlobCreationCancelCode cancel_code);
+
// Not owned.
Delegate* delegate_;
@@ -268,6 +282,8 @@ class CONTENT_EXPORT ServiceWorkerURLRequestJob
bool response_is_in_cache_storage_ = false;
std::string response_cache_storage_cache_name_;
+ size_t num_pending_request_body_blobs_ = 0;
+
base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob);

Powered by Google App Engine
This is Rietveld 408576698