[ServiceWorker] Make Stream support in ServiceWorkerURLRequestJob
In ServiceWorkerURLRequestJob::DidDispatchFetchEvent(), if response.stream_url of ServiceWorkerHostMsg_FetchEventFinished is set, ServiceWorkerURLRequestJob starts reading the body of the response from the stream instead of the blob.
But the stream may not be registered yet.
It is because ServiceWorkerHostMsg_FetchEventFinished is sent from the worker thread but StreamHostMsg_StartBuilding which triggers the stream registration is sent from the main thread of the ServiceWorker process.
So if ServiceWorkerURLRequestJob can't get the stream in DidDispatchFetchEvent(), call StreamRegistry::SetRegisterObserver() to receive the stream registration event.
When ServiceWorkerURLRequestJob successfuly gets the stream, it starts reading the stream.
The codes for reading the stream is almost same as the codes in StreamURLRequestJob.
This change depends on these changes:
https://codereview.chromium.org/760823002
https://codereview.chromium.org/759823003
BUG=436424
Review URL: https://codereview.chromium.org/759203002
Cr-Commit-Position: refs/heads/master@{#308059}
diff --git a/base/supports_user_data.h b/base/supports_user_data.h
index 6d515d73..711ee7d 100644
--- a/base/supports_user_data.h
+++ b/base/supports_user_data.h
@@ -61,7 +61,7 @@
template <typename T>
class UserDataAdapter : public base::SupportsUserData::Data {
public:
- static T* Get(SupportsUserData* supports_user_data, const void* key) {
+ static T* Get(const SupportsUserData* supports_user_data, const void* key) {
UserDataAdapter* data =
static_cast<UserDataAdapter*>(supports_user_data->GetUserData(key));
return data ? static_cast<T*>(data->object_.get()) : NULL;