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

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

Issue 2183323005: Make Resource::m_response private (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(); 110 WeakPtr<RawResourceClient> clientWeak = client->createWeakPtr();
111 for (const auto& redirect : redirectChain()) { 111 for (const auto& redirect : redirectChain()) {
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 (!m_response.isNull()) 118 if (!response().isNull())
119 client->responseReceived(this, m_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 (m_data)
123 client->dataReceived(this, m_data->data(), m_data->size()); 123 client->dataReceived(this, m_data->data(), m_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)
(...skipping 16 matching lines...) Expand all
146 void RawResource::responseReceived(const ResourceResponse& response, std::unique _ptr<WebDataConsumerHandle> handle) 146 void RawResource::responseReceived(const ResourceResponse& response, std::unique _ptr<WebDataConsumerHandle> handle)
147 { 147 {
148 bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCod e() == 304; 148 bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCod e() == 304;
149 Resource::responseReceived(response, nullptr); 149 Resource::responseReceived(response, nullptr);
150 150
151 ResourceClientWalker<RawResourceClient> w(clients()); 151 ResourceClientWalker<RawResourceClient> w(clients());
152 DCHECK(clients().size() <= 1 || !handle); 152 DCHECK(clients().size() <= 1 || !handle);
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, m_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 && m_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, m_data->data(), m_data->size());
(...skipping 91 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