| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 while (RawResourceClient* c = w.next()) | 98 while (RawResourceClient* c = w.next()) |
| 99 c->dataReceived(this, data, length); | 99 c->dataReceived(this, data, length); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void RawResource::didAddClient(ResourceClient* c) | 102 void RawResource::didAddClient(ResourceClient* c) |
| 103 { | 103 { |
| 104 if (!hasClient(c)) | 104 if (!hasClient(c)) |
| 105 return; | 105 return; |
| 106 ASSERT(RawResourceClient::isExpectedType(c)); | 106 ASSERT(RawResourceClient::isExpectedType(c)); |
| 107 RawResourceClient* client = static_cast<RawResourceClient*>(c); | 107 RawResourceClient* client = static_cast<RawResourceClient*>(c); |
| 108 WeakPtr<RawResourceClient> clientWeak = client->createWeakPtr(); |
| 108 for (const auto& redirect : redirectChain()) { | 109 for (const auto& redirect : redirectChain()) { |
| 109 ResourceRequest request(redirect.m_request); | 110 ResourceRequest request(redirect.m_request); |
| 110 client->redirectReceived(this, request, redirect.m_redirectResponse); | 111 client->redirectReceived(this, request, redirect.m_redirectResponse); |
| 111 if (!hasClient(c)) | 112 if (!clientWeak || !hasClient(c)) |
| 112 return; | 113 return; |
| 113 } | 114 } |
| 114 | 115 |
| 115 if (!m_response.isNull()) | 116 if (!m_response.isNull()) |
| 116 client->responseReceived(this, m_response, nullptr); | 117 client->responseReceived(this, m_response, nullptr); |
| 117 if (!hasClient(c)) | 118 if (!clientWeak || !hasClient(c)) |
| 118 return; | 119 return; |
| 119 if (m_data) | 120 if (m_data) |
| 120 client->dataReceived(this, m_data->data(), m_data->size()); | 121 client->dataReceived(this, m_data->data(), m_data->size()); |
| 121 if (!hasClient(c)) | 122 if (!clientWeak || !hasClient(c)) |
| 122 return; | 123 return; |
| 123 Resource::didAddClient(client); | 124 Resource::didAddClient(client); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void RawResource::willFollowRedirect(ResourceRequest& newRequest, const Resource
Response& redirectResponse) | 127 void RawResource::willFollowRedirect(ResourceRequest& newRequest, const Resource
Response& redirectResponse) |
| 127 { | 128 { |
| 128 Resource::willFollowRedirect(newRequest, redirectResponse); | 129 Resource::willFollowRedirect(newRequest, redirectResponse); |
| 129 | 130 |
| 130 ASSERT(!redirectResponse.isNull()); | 131 ASSERT(!redirectResponse.isNull()); |
| 131 ResourceClientWalker<RawResourceClient> w(m_clients); | 132 ResourceClientWalker<RawResourceClient> w(m_clients); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 for (const auto& header : oldHeaders) { | 257 for (const auto& header : oldHeaders) { |
| 257 AtomicString headerName = header.key; | 258 AtomicString headerName = header.key; |
| 258 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) | 259 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) |
| 259 return false; | 260 return false; |
| 260 } | 261 } |
| 261 | 262 |
| 262 return true; | 263 return true; |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |