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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 723423002: Clear ResourceFetcher::m_validatedURLs if too many entries are added (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: define kMaxValidatedURLsSize Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 670 }
671 671
672 void ResourceFetcher::maybeNotifyInsecureContent(const Resource* resource) const 672 void ResourceFetcher::maybeNotifyInsecureContent(const Resource* resource) const
673 { 673 {
674 // As a side effect browser will be notified. 674 // As a side effect browser will be notified.
675 MixedContentChecker::shouldBlockFetch(frame(), 675 MixedContentChecker::shouldBlockFetch(frame(),
676 resource->lastResourceRequest(), 676 resource->lastResourceRequest(),
677 resource->lastResourceRequest().url()) ; 677 resource->lastResourceRequest().url()) ;
678 } 678 }
679 679
680 // Limit the number of URLs in m_validatedURLs to avoid memory bloat.
681 // http://crbug.com/52411
682 static const int kMaxValidatedURLsSize = 10000;
PhistucK 2014/11/14 12:30:36 This seems like a lot to me (10,000 URLs, right?).
683
680 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest& request, ResourceLoadStartType type) 684 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest& request, ResourceLoadStartType type)
681 { 685 {
682 if (type == ResourceLoadingFromCache) 686 if (type == ResourceLoadingFromCache)
683 notifyLoadedFromMemoryCache(resource); 687 notifyLoadedFromMemoryCache(resource);
684 688
685 if (request.resourceRequest().url().protocolIsData() || (m_documentLoader && m_documentLoader->substituteData().isValid())) 689 if (request.resourceRequest().url().protocolIsData() || (m_documentLoader && m_documentLoader->substituteData().isValid()))
686 return; 690 return;
687 691
688 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_va lidatedURLs.contains(request.resourceRequest().url())) { 692 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_va lidatedURLs.contains(request.resourceRequest().url())) {
689 // Resources loaded from memory cache should be reported the first time they're used. 693 // Resources loaded from memory cache should be reported the first time they're used.
690 RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt ions().initiatorInfo.name, monotonicallyIncreasingTime()); 694 RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt ions().initiatorInfo.name, monotonicallyIncreasingTime());
691 populateResourceTiming(info.get(), resource, true); 695 populateResourceTiming(info.get(), resource, true);
692 m_scheduledResourceTimingReports.add(info, resource->type() == Resource: :MainResource); 696 m_scheduledResourceTimingReports.add(info, resource->type() == Resource: :MainResource);
693 if (!m_resourceTimingReportTimer.isActive()) 697 if (!m_resourceTimingReportTimer.isActive())
694 m_resourceTimingReportTimer.startOneShot(0, FROM_HERE); 698 m_resourceTimingReportTimer.startOneShot(0, FROM_HERE);
695 } 699 }
696 700
701 if (m_validatedURLs.size() >= kMaxValidatedURLsSize) {
702 m_validatedURLs.clear();
703 }
697 m_validatedURLs.add(request.resourceRequest().url()); 704 m_validatedURLs.add(request.resourceRequest().url());
698 } 705 }
699 706
700 ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc hRequest& request) 707 ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc hRequest& request)
701 { 708 {
702 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || type == Resource::Raw); 709 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || type == Resource::Raw);
703 710
704 TRACE_EVENT0("blink", "ResourceFetcher::requestResource"); 711 TRACE_EVENT0("blink", "ResourceFetcher::requestResource");
705 712
706 KURL url = request.resourceRequest().url(); 713 KURL url = request.resourceRequest().url();
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 1572
1566 void ResourceFetcher::trace(Visitor* visitor) 1573 void ResourceFetcher::trace(Visitor* visitor)
1567 { 1574 {
1568 visitor->trace(m_document); 1575 visitor->trace(m_document);
1569 visitor->trace(m_loaders); 1576 visitor->trace(m_loaders);
1570 visitor->trace(m_multipartLoaders); 1577 visitor->trace(m_multipartLoaders);
1571 ResourceLoaderHost::trace(visitor); 1578 ResourceLoaderHost::trace(visitor);
1572 } 1579 }
1573 1580
1574 } 1581 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698