Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/core/fetch/RawResource.cpp

Issue 2202173002: Refactoring: Make Resource::m_data private (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on hiroshige's review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ResourceRequest request(redirect.m_request); 112 ResourceRequest request(redirect.m_request);
113 client->redirectReceived(this, request, redirect.m_redirectResponse); 113 client->redirectReceived(this, request, redirect.m_redirectResponse);
114 if (!clientWeak || !hasClient(c)) 114 if (!clientWeak || !hasClient(c))
115 return; 115 return;
116 } 116 }
117 117
118 if (!response().isNull()) 118 if (!response().isNull())
119 client->responseReceived(this, response(), nullptr); 119 client->responseReceived(this, response(), nullptr);
120 if (!clientWeak || !hasClient(c)) 120 if (!clientWeak || !hasClient(c))
121 return; 121 return;
122 if (m_data) 122 if (data())
123 client->dataReceived(this, m_data->data(), m_data->size()); 123 client->dataReceived(this, data()->data(), data()->size());
124 if (!clientWeak || !hasClient(c)) 124 if (!clientWeak || !hasClient(c))
125 return; 125 return;
126 Resource::didAddClient(client); 126 Resource::didAddClient(client);
127 } 127 }
128 128
129 void RawResource::willFollowRedirect(ResourceRequest& newRequest, const Resource Response& redirectResponse) 129 void RawResource::willFollowRedirect(ResourceRequest& newRequest, const Resource Response& redirectResponse)
130 { 130 {
131 Resource::willFollowRedirect(newRequest, redirectResponse); 131 Resource::willFollowRedirect(newRequest, redirectResponse);
132 132
133 ASSERT(!redirectResponse.isNull()); 133 ASSERT(!redirectResponse.isNull());
(...skipping 19 matching lines...) Expand all
153 while (RawResourceClient* c = w.next()) { 153 while (RawResourceClient* c = w.next()) {
154 // |handle| is cleared when passed, but it's not a problem because 154 // |handle| is cleared when passed, but it's not a problem because
155 // |handle| is null when there are two or more clients, as asserted. 155 // |handle| is null when there are two or more clients, as asserted.
156 c->responseReceived(this, this->response(), std::move(handle)); 156 c->responseReceived(this, this->response(), std::move(handle));
157 } 157 }
158 158
159 // If we successfully revalidated, we won't get appendData() calls. 159 // If we successfully revalidated, we won't get appendData() calls.
160 // Forward the data to clients now instead. 160 // Forward the data to clients now instead.
161 // Note: |m_data| can be null when no data is appended to the original 161 // Note: |m_data| can be null when no data is appended to the original
162 // resource. 162 // resource.
163 if (isSuccessfulRevalidation && m_data) { 163 if (isSuccessfulRevalidation && data()) {
164 ResourceClientWalker<RawResourceClient> w(clients()); 164 ResourceClientWalker<RawResourceClient> w(clients());
165 while (RawResourceClient* c = w.next()) 165 while (RawResourceClient* c = w.next())
166 c->dataReceived(this, m_data->data(), m_data->size()); 166 c->dataReceived(this, data()->data(), data()->size());
167 } 167 }
168 } 168 }
169 169
170 void RawResource::setSerializedCachedMetadata(const char* data, size_t size) 170 void RawResource::setSerializedCachedMetadata(const char* data, size_t size)
171 { 171 {
172 Resource::setSerializedCachedMetadata(data, size); 172 Resource::setSerializedCachedMetadata(data, size);
173 ResourceClientWalker<RawResourceClient> w(clients()); 173 ResourceClientWalker<RawResourceClient> w(clients());
174 while (RawResourceClient* c = w.next()) 174 while (RawResourceClient* c = w.next())
175 c->setSerializedCachedMetadata(this, data, size); 175 c->setSerializedCachedMetadata(this, data, size);
176 } 176 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 for (const auto& header : oldHeaders) { 258 for (const auto& header : oldHeaders) {
259 AtomicString headerName = header.key; 259 AtomicString headerName = header.key;
260 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName)) 260 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName))
261 return false; 261 return false;
262 } 262 }
263 263
264 return true; 264 return true;
265 } 265 }
266 266
267 } // namespace blink 267 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.cpp ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698