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