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