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