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

Side by Side Diff: Source/web/AssociatedURLLoader.cpp

Issue 603903003: [Streams] Pass WebDataConsumerHandle when the response arrives. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@web-data-pipe
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « Source/modules/serviceworkers/FetchManager.cpp ('k') | public/platform/WebURLLoaderClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // This class bridges the interface differences between WebCore and WebKit loade r clients. 118 // This class bridges the interface differences between WebCore and WebKit loade r clients.
119 // It forwards its ThreadableLoaderClient notifications to a WebURLLoaderClient. 119 // It forwards its ThreadableLoaderClient notifications to a WebURLLoaderClient.
120 class AssociatedURLLoader::ClientAdapter final : public DocumentThreadableLoader Client { 120 class AssociatedURLLoader::ClientAdapter final : public DocumentThreadableLoader Client {
121 WTF_MAKE_NONCOPYABLE(ClientAdapter); 121 WTF_MAKE_NONCOPYABLE(ClientAdapter);
122 public: 122 public:
123 static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderCl ient*, const WebURLLoaderOptions&); 123 static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderCl ient*, const WebURLLoaderOptions&);
124 124
125 // ThreadableLoaderClient 125 // ThreadableLoaderClient
126 void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*tota lBytesToBeSent*/) override; 126 void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*tota lBytesToBeSent*/) override;
127 void didReceiveResponse(unsigned long, const ResourceResponse&) override; 127 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W ebDataConsumerHandle>) override;
128 void didDownloadData(int /*dataLength*/) override; 128 void didDownloadData(int /*dataLength*/) override;
129 void didReceiveData(const char*, unsigned /*dataLength*/) override; 129 void didReceiveData(const char*, unsigned /*dataLength*/) override;
130 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; 130 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override;
131 void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) o verride; 131 void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) o verride;
132 void didFail(const ResourceError&) override; 132 void didFail(const ResourceError&) override;
133 void didFailRedirectCheck() override; 133 void didFailRedirectCheck() override;
134 // DocumentThreadableLoaderClient 134 // DocumentThreadableLoaderClient
135 void willFollowRedirect(ResourceRequest& /*newRequest*/, const ResourceRespo nse& /*redirectResponse*/) override; 135 void willFollowRedirect(ResourceRequest& /*newRequest*/, const ResourceRespo nse& /*redirectResponse*/) override;
136 136
137 // Sets an error to be reported back to the client, asychronously. 137 // Sets an error to be reported back to the client, asychronously.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen t, unsigned long long totalBytesToBeSent) 189 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen t, unsigned long long totalBytesToBeSent)
190 { 190 {
191 if (!m_client) 191 if (!m_client)
192 return; 192 return;
193 193
194 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); 194 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent);
195 } 195 }
196 196
197 void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response) 197 void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle)
198 { 198 {
199 ASSERT_UNUSED(handle, !handle);
199 if (!m_client) 200 if (!m_client)
200 return; 201 return;
201 202
202 // Try to use the original ResourceResponse if possible. 203 // Try to use the original ResourceResponse if possible.
203 WebURLResponse validatedResponse = WrappedResourceResponse(response); 204 WebURLResponse validatedResponse = WrappedResourceResponse(response);
204 HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy == WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl); 205 HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy == WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl);
205 if (!m_options.exposeAllResponseHeaders) 206 if (!m_options.exposeAllResponseHeaders)
206 validatedResponse.visitHTTPHeaderFields(&validator); 207 validatedResponse.visitHTTPHeaderFields(&validator);
207 208
208 // If there are blocked headers, copy the response so we can remove them. 209 // If there are blocked headers, copy the response so we can remove them.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 m_loader->cancel(); 377 m_loader->cancel();
377 } 378 }
378 379
379 void AssociatedURLLoader::setDefersLoading(bool defersLoading) 380 void AssociatedURLLoader::setDefersLoading(bool defersLoading)
380 { 381 {
381 if (m_loader) 382 if (m_loader)
382 m_loader->setDefersLoading(defersLoading); 383 m_loader->setDefersLoading(defersLoading);
383 } 384 }
384 385
385 } // namespace blink 386 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/FetchManager.cpp ('k') | public/platform/WebURLLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698