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

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

Issue 2230173002: Change WebURLLoaderClient::willFollowRedirect() API to return bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void didReceiveResponse(unsigned long, 98 void didReceiveResponse(unsigned long,
99 const ResourceResponse&, 99 const ResourceResponse&,
100 std::unique_ptr<WebDataConsumerHandle>) override; 100 std::unique_ptr<WebDataConsumerHandle>) override;
101 void didDownloadData(int /*dataLength*/) override; 101 void didDownloadData(int /*dataLength*/) override;
102 void didReceiveData(const char*, unsigned /*dataLength*/) override; 102 void didReceiveData(const char*, unsigned /*dataLength*/) override;
103 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; 103 void didReceiveCachedMetadata(const char*, int /*dataLength*/) override;
104 void didFinishLoading(unsigned long /*identifier*/, 104 void didFinishLoading(unsigned long /*identifier*/,
105 double /*finishTime*/) override; 105 double /*finishTime*/) override;
106 void didFail(const ResourceError&) override; 106 void didFail(const ResourceError&) override;
107 void didFailRedirectCheck() override; 107 void didFailRedirectCheck() override;
108
108 // DocumentThreadableLoaderClient 109 // DocumentThreadableLoaderClient
109 void willFollowRedirect( 110 bool willFollowRedirect(
110 ResourceRequest& /*newRequest*/, 111 const ResourceRequest& /*newRequest*/,
111 const ResourceResponse& /*redirectResponse*/) override; 112 const ResourceResponse& /*redirectResponse*/) override;
112 113
113 // Sets an error to be reported back to the client, asychronously. 114 // Sets an error to be reported back to the client, asychronously.
114 void setDelayedError(const ResourceError&); 115 void setDelayedError(const ResourceError&);
115 116
116 // Enables forwarding of error notifications to the WebURLLoaderClient. These 117 // Enables forwarding of error notifications to the WebURLLoaderClient. These
117 // must be deferred until after the call to 118 // must be deferred until after the call to
118 // AssociatedURLLoader::loadAsynchronously() completes. 119 // AssociatedURLLoader::loadAsynchronously() completes.
119 void enableErrorNotifications(); 120 void enableErrorNotifications();
120 121
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 : m_loader(loader), 158 : m_loader(loader),
158 m_client(client), 159 m_client(client),
159 m_options(options), 160 m_options(options),
160 m_errorTimer(this, &ClientAdapter::notifyError), 161 m_errorTimer(this, &ClientAdapter::notifyError),
161 m_enableErrorNotifications(false), 162 m_enableErrorNotifications(false),
162 m_didFail(false) { 163 m_didFail(false) {
163 DCHECK(m_loader); 164 DCHECK(m_loader);
164 DCHECK(m_client); 165 DCHECK(m_client);
165 } 166 }
166 167
167 void AssociatedURLLoader::ClientAdapter::willFollowRedirect( 168 bool AssociatedURLLoader::ClientAdapter::willFollowRedirect(
168 ResourceRequest& newRequest, 169 const ResourceRequest& newRequest,
169 const ResourceResponse& redirectResponse) { 170 const ResourceResponse& redirectResponse) {
170 if (!m_client) 171 if (!m_client)
171 return; 172 return true;
172 173
173 WrappedResourceRequest wrappedNewRequest(newRequest); 174 WrappedResourceRequest wrappedNewRequest(newRequest);
174 WrappedResourceResponse wrappedRedirectResponse(redirectResponse); 175 WrappedResourceResponse wrappedRedirectResponse(redirectResponse);
175 m_client->willFollowRedirect(m_loader, wrappedNewRequest, 176 return m_client->willFollowRedirect(m_loader, wrappedNewRequest,
176 wrappedRedirectResponse); 177 wrappedRedirectResponse);
177 } 178 }
178 179
179 void AssociatedURLLoader::ClientAdapter::didSendData( 180 void AssociatedURLLoader::ClientAdapter::didSendData(
180 unsigned long long bytesSent, 181 unsigned long long bytesSent,
181 unsigned long long totalBytesToBeSent) { 182 unsigned long long totalBytesToBeSent) {
182 if (!m_client) 183 if (!m_client)
183 return; 184 return;
184 185
185 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); 186 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent);
186 } 187 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // there could be a WebURLLoader instance behind the 482 // there could be a WebURLLoader instance behind the
482 // DocumentThreadableLoader instance. So, for safety, we chose to just 483 // DocumentThreadableLoader instance. So, for safety, we chose to just
483 // crash here. 484 // crash here.
484 RELEASE_ASSERT(ThreadState::current()); 485 RELEASE_ASSERT(ThreadState::current());
485 486
486 m_observer->dispose(); 487 m_observer->dispose();
487 m_observer = nullptr; 488 m_observer = nullptr;
488 } 489 }
489 490
490 } // namespace blink 491 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698