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

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

Issue 2585283002: Migrate WTF::Vector::append() to ::push_back() [part 6 of N] (Closed)
Patch Set: Created 4 years 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
7 rights reserved. 7 rights reserved.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 m_taskHandle.cancel(); 288 m_taskHandle.cancel();
289 } 289 }
290 290
291 bool Resource::ResourceCallback::isScheduled(Resource* resource) const { 291 bool Resource::ResourceCallback::isScheduled(Resource* resource) const {
292 return m_resourcesWithPendingClients.contains(resource); 292 return m_resourcesWithPendingClients.contains(resource);
293 } 293 }
294 294
295 void Resource::ResourceCallback::runTask() { 295 void Resource::ResourceCallback::runTask() {
296 HeapVector<Member<Resource>> resources; 296 HeapVector<Member<Resource>> resources;
297 for (const Member<Resource>& resource : m_resourcesWithPendingClients) 297 for (const Member<Resource>& resource : m_resourcesWithPendingClients)
298 resources.append(resource.get()); 298 resources.push_back(resource.get());
299 m_resourcesWithPendingClients.clear(); 299 m_resourcesWithPendingClients.clear();
300 300
301 for (const auto& resource : resources) 301 for (const auto& resource : resources)
302 resource->finishPendingClients(); 302 resource->finishPendingClients();
303 } 303 }
304 304
305 constexpr Resource::Status Resource::NotStarted; 305 constexpr Resource::Status Resource::NotStarted;
306 constexpr Resource::Status Resource::Pending; 306 constexpr Resource::Status Resource::Pending;
307 constexpr Resource::Status Resource::Cached; 307 constexpr Resource::Status Resource::Cached;
308 constexpr Resource::Status Resource::LoadError; 308 constexpr Resource::Status Resource::LoadError;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 DCHECK(!request.isNull()); 578 DCHECK(!request.isNull());
579 m_isRevalidating = true; 579 m_isRevalidating = true;
580 m_resourceRequest = request; 580 m_resourceRequest = request;
581 m_status = NotStarted; 581 m_status = NotStarted;
582 } 582 }
583 583
584 bool Resource::willFollowRedirect(const ResourceRequest& newRequest, 584 bool Resource::willFollowRedirect(const ResourceRequest& newRequest,
585 const ResourceResponse& redirectResponse) { 585 const ResourceResponse& redirectResponse) {
586 if (m_isRevalidating) 586 if (m_isRevalidating)
587 revalidationFailed(); 587 revalidationFailed();
588 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); 588 m_redirectChain.push_back(RedirectPair(newRequest, redirectResponse));
589 return true; 589 return true;
590 } 590 }
591 591
592 void Resource::setResponse(const ResourceResponse& response) { 592 void Resource::setResponse(const ResourceResponse& response) {
593 m_response = response; 593 m_response = response;
594 if (m_response.wasFetchedViaServiceWorker()) { 594 if (m_response.wasFetchedViaServiceWorker()) {
595 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create( 595 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create(
596 this, m_fetcherSecurityOrigin.get()); 596 this, m_fetcherSecurityOrigin.get());
597 } 597 }
598 } 598 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 urlToReport.truncate(kMaxURLReportLength); 882 urlToReport.truncate(kMaxURLReportLength);
883 urlToReport = urlToReport + "..."; 883 urlToReport = urlToReport + "...";
884 } 884 }
885 dump->addString("url", "", urlToReport); 885 dump->addString("url", "", urlToReport);
886 886
887 dump->addString("reason_not_deletable", "", reasonNotDeletable()); 887 dump->addString("reason_not_deletable", "", reasonNotDeletable());
888 888
889 Vector<String> clientNames; 889 Vector<String> clientNames;
890 ResourceClientWalker<ResourceClient> walker(m_clients); 890 ResourceClientWalker<ResourceClient> walker(m_clients);
891 while (ResourceClient* client = walker.next()) 891 while (ResourceClient* client = walker.next())
892 clientNames.append(client->debugName()); 892 clientNames.push_back(client->debugName());
893 ResourceClientWalker<ResourceClient> walker2(m_clientsAwaitingCallback); 893 ResourceClientWalker<ResourceClient> walker2(m_clientsAwaitingCallback);
894 while (ResourceClient* client = walker2.next()) 894 while (ResourceClient* client = walker2.next())
895 clientNames.append("(awaiting) " + client->debugName()); 895 clientNames.push_back("(awaiting) " + client->debugName());
896 ResourceClientWalker<ResourceClient> walker3(m_finishedClients); 896 ResourceClientWalker<ResourceClient> walker3(m_finishedClients);
897 while (ResourceClient* client = walker3.next()) 897 while (ResourceClient* client = walker3.next())
898 clientNames.append("(finished) " + client->debugName()); 898 clientNames.push_back("(finished) " + client->debugName());
899 std::sort(clientNames.begin(), clientNames.end(), 899 std::sort(clientNames.begin(), clientNames.end(),
900 WTF::codePointCompareLessThan); 900 WTF::codePointCompareLessThan);
901 901
902 StringBuilder builder; 902 StringBuilder builder;
903 for (size_t i = 0; 903 for (size_t i = 0;
904 i < clientNames.size() && i < kMaxResourceClientToShowInMemoryInfra; 904 i < clientNames.size() && i < kMaxResourceClientToShowInMemoryInfra;
905 ++i) { 905 ++i) {
906 if (i > 0) 906 if (i > 0)
907 builder.append(" / "); 907 builder.append(" / ");
908 builder.append(clientNames[i]); 908 builder.append(clientNames[i]);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 case Resource::Media: 1117 case Resource::Media:
1118 case Resource::Manifest: 1118 case Resource::Manifest:
1119 case Resource::Mock: 1119 case Resource::Mock:
1120 return false; 1120 return false;
1121 } 1121 }
1122 NOTREACHED(); 1122 NOTREACHED();
1123 return false; 1123 return false;
1124 } 1124 }
1125 1125
1126 } // namespace blink 1126 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCache.cpp ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698