OLD | NEW |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // ThreadableLoaderClient | 87 // ThreadableLoaderClient |
88 void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*tota
lBytesToBeSent*/) override; | 88 void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*tota
lBytesToBeSent*/) override; |
89 void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_
ptr<WebDataConsumerHandle>) override; | 89 void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_
ptr<WebDataConsumerHandle>) override; |
90 void didDownloadData(int /*dataLength*/) override; | 90 void didDownloadData(int /*dataLength*/) override; |
91 void didReceiveData(const char*, unsigned /*dataLength*/) override; | 91 void didReceiveData(const char*, unsigned /*dataLength*/) override; |
92 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; | 92 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; |
93 void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) o
verride; | 93 void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) o
verride; |
94 void didFail(const ResourceError&) override; | 94 void didFail(const ResourceError&) override; |
95 void didFailRedirectCheck() override; | 95 void didFailRedirectCheck() override; |
| 96 |
96 // DocumentThreadableLoaderClient | 97 // DocumentThreadableLoaderClient |
97 void willFollowRedirect(ResourceRequest& /*newRequest*/, const ResourceRespo
nse& /*redirectResponse*/) override; | 98 bool willFollowRedirect(ResourceRequest& /*newRequest*/, const ResourceRespo
nse& /*redirectResponse*/) override; |
98 | 99 |
99 // Sets an error to be reported back to the client, asychronously. | 100 // Sets an error to be reported back to the client, asychronously. |
100 void setDelayedError(const ResourceError&); | 101 void setDelayedError(const ResourceError&); |
101 | 102 |
102 // Enables forwarding of error notifications to the WebURLLoaderClient. Thes
e must be | 103 // Enables forwarding of error notifications to the WebURLLoaderClient. Thes
e must be |
103 // deferred until after the call to AssociatedURLLoader::loadAsynchronously(
) completes. | 104 // deferred until after the call to AssociatedURLLoader::loadAsynchronously(
) completes. |
104 void enableErrorNotifications(); | 105 void enableErrorNotifications(); |
105 | 106 |
106 // Stops loading and releases the DocumentThreadableLoader as early as possi
ble. | 107 // Stops loading and releases the DocumentThreadableLoader as early as possi
ble. |
107 WebURLLoaderClient* releaseClient() | 108 WebURLLoaderClient* releaseClient() |
(...skipping 28 matching lines...) Expand all Loading... |
136 , m_client(client) | 137 , m_client(client) |
137 , m_options(options) | 138 , m_options(options) |
138 , m_errorTimer(this, &ClientAdapter::notifyError) | 139 , m_errorTimer(this, &ClientAdapter::notifyError) |
139 , m_enableErrorNotifications(false) | 140 , m_enableErrorNotifications(false) |
140 , m_didFail(false) | 141 , m_didFail(false) |
141 { | 142 { |
142 DCHECK(m_loader); | 143 DCHECK(m_loader); |
143 DCHECK(m_client); | 144 DCHECK(m_client); |
144 } | 145 } |
145 | 146 |
146 void AssociatedURLLoader::ClientAdapter::willFollowRedirect(ResourceRequest& new
Request, const ResourceResponse& redirectResponse) | 147 bool AssociatedURLLoader::ClientAdapter::willFollowRedirect(ResourceRequest& new
Request, const ResourceResponse& redirectResponse) |
147 { | 148 { |
148 if (!m_client) | 149 if (!m_client) |
149 return; | 150 return true; |
150 | 151 |
151 WrappedResourceRequest wrappedNewRequest(newRequest); | 152 WrappedResourceRequest wrappedNewRequest(newRequest); |
152 WrappedResourceResponse wrappedRedirectResponse(redirectResponse); | 153 WrappedResourceResponse wrappedRedirectResponse(redirectResponse); |
153 // TODO(ricea): Do we need to set encodedDataLength here? | 154 // TODO(ricea): Do we need to set encodedDataLength here? |
154 m_client->willFollowRedirect(m_loader, wrappedNewRequest, wrappedRedirectRes
ponse, 0); | 155 return m_client->willFollowRedirect(m_loader, wrappedNewRequest, wrappedRedi
rectResponse, 0); |
155 } | 156 } |
156 | 157 |
157 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen
t, unsigned long long totalBytesToBeSent) | 158 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen
t, unsigned long long totalBytesToBeSent) |
158 { | 159 { |
159 if (!m_client) | 160 if (!m_client) |
160 return; | 161 return; |
161 | 162 |
162 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); | 163 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); |
163 } | 164 } |
164 | 165 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // there could be a WebURLLoader instance behind the | 454 // there could be a WebURLLoader instance behind the |
454 // DocumentThreadableLoader instance. So, for safety, we chose to just | 455 // DocumentThreadableLoader instance. So, for safety, we chose to just |
455 // crash here. | 456 // crash here. |
456 RELEASE_ASSERT(ThreadState::current()); | 457 RELEASE_ASSERT(ThreadState::current()); |
457 | 458 |
458 m_observer->dispose(); | 459 m_observer->dispose(); |
459 m_observer = nullptr; | 460 m_observer = nullptr; |
460 } | 461 } |
461 | 462 |
462 } // namespace blink | 463 } // namespace blink |
OLD | NEW |