| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 if (!hasClient(c)) | 120 if (!hasClient(c)) |
| 121 return; | 121 return; |
| 122 if (data()) | 122 if (data()) |
| 123 client->dataReceived(this, data()->data(), data()->size()); | 123 client->dataReceived(this, data()->data(), data()->size()); |
| 124 CHECK(!isCacheValidator()); | 124 CHECK(!isCacheValidator()); |
| 125 if (!hasClient(c)) | 125 if (!hasClient(c)) |
| 126 return; | 126 return; |
| 127 Resource::didAddClient(client); | 127 Resource::didAddClient(client); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void RawResource::willFollowRedirect(ResourceRequest& newRequest, const Resource
Response& redirectResponse) | 130 bool RawResource::willFollowRedirect(const ResourceRequest& newRequest, const Re
sourceResponse& redirectResponse) |
| 131 { | 131 { |
| 132 Resource::willFollowRedirect(newRequest, redirectResponse); | 132 bool follow = Resource::willFollowRedirect(newRequest, redirectResponse); |
| 133 // The base class method takes a non const reference of a ResourceRequest |
| 134 // and returns bool just for allowing RawResource to reject redirect. It |
| 135 // must always return true. |
| 136 DCHECK(follow); |
| 133 | 137 |
| 134 DCHECK(!redirectResponse.isNull()); | 138 DCHECK(!redirectResponse.isNull()); |
| 135 ResourceClientWalker<RawResourceClient> w(clients()); | 139 ResourceClientWalker<RawResourceClient> w(clients()); |
| 136 while (RawResourceClient* c = w.next()) | 140 while (RawResourceClient* c = w.next()) { |
| 137 c->redirectReceived(this, newRequest, redirectResponse); | 141 if (!c->redirectReceived(this, newRequest, redirectResponse)) |
| 142 follow = false; |
| 143 } |
| 144 |
| 145 return follow; |
| 138 } | 146 } |
| 139 | 147 |
| 140 void RawResource::willNotFollowRedirect() | 148 void RawResource::willNotFollowRedirect() |
| 141 { | 149 { |
| 142 ResourceClientWalker<RawResourceClient> w(clients()); | 150 ResourceClientWalker<RawResourceClient> w(clients()); |
| 143 while (RawResourceClient* c = w.next()) | 151 while (RawResourceClient* c = w.next()) |
| 144 c->redirectBlocked(); | 152 c->redirectBlocked(); |
| 145 } | 153 } |
| 146 | 154 |
| 147 void RawResource::responseReceived(const ResourceResponse& response, std::unique
_ptr<WebDataConsumerHandle> handle) | 155 void RawResource::responseReceived(const ResourceResponse& response, std::unique
_ptr<WebDataConsumerHandle> handle) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 345 |
| 338 NEVER_INLINE void RawResourceClientStateChecker::notifyFinished(Resource* resour
ce) | 346 NEVER_INLINE void RawResourceClientStateChecker::notifyFinished(Resource* resour
ce) |
| 339 { | 347 { |
| 340 SECURITY_CHECK(m_state != NotAddedAsClient); | 348 SECURITY_CHECK(m_state != NotAddedAsClient); |
| 341 SECURITY_CHECK(m_state != NotifyFinished); | 349 SECURITY_CHECK(m_state != NotifyFinished); |
| 342 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived ||
m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state ==
DataDownloaded)); | 350 SECURITY_CHECK(resource->errorOccurred() || (m_state == ResponseReceived ||
m_state == SetSerializedCachedMetadata || m_state == DataReceived || m_state ==
DataDownloaded)); |
| 343 m_state = NotifyFinished; | 351 m_state = NotifyFinished; |
| 344 } | 352 } |
| 345 | 353 |
| 346 } // namespace blink | 354 } // namespace blink |
| OLD | NEW |