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

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

Issue 1983753002: Remove OwnPtr::release() calls in core/ (part 2). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 if (isStaticData) 271 if (isStaticData)
272 return; 272 return;
273 273
274 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_va lidatedURLs.contains(request.resourceRequest().url())) { 274 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_va lidatedURLs.contains(request.resourceRequest().url())) {
275 // Resources loaded from memory cache should be reported the first time they're used. 275 // Resources loaded from memory cache should be reported the first time they're used.
276 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt ions().initiatorInfo.name, monotonicallyIncreasingTime(), resource->getType() == Resource::MainResource); 276 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt ions().initiatorInfo.name, monotonicallyIncreasingTime(), resource->getType() == Resource::MainResource);
277 populateResourceTiming(info.get(), resource); 277 populateResourceTiming(info.get(), resource);
278 info->clearLoadTimings(); 278 info->clearLoadTimings();
279 info->setLoadFinishTime(info->initialTime()); 279 info->setLoadFinishTime(info->initialTime());
280 m_scheduledResourceTimingReports.append(info.release()); 280 m_scheduledResourceTimingReports.append(std::move(info));
281 if (!m_resourceTimingReportTimer.isActive()) 281 if (!m_resourceTimingReportTimer.isActive())
282 m_resourceTimingReportTimer.startOneShot(0, BLINK_FROM_HERE); 282 m_resourceTimingReportTimer.startOneShot(0, BLINK_FROM_HERE);
283 } 283 }
284 284
285 if (m_validatedURLs.size() >= kMaxValidatedURLsSize) { 285 if (m_validatedURLs.size() >= kMaxValidatedURLsSize) {
286 m_validatedURLs.clear(); 286 m_validatedURLs.clear();
287 } 287 }
288 m_validatedURLs.add(request.resourceRequest().url()); 288 m_validatedURLs.add(request.resourceRequest().url());
289 } 289 }
290 290
291 static PassOwnPtr<TracedValue> urlForTraceEvent(const KURL& url) 291 static PassOwnPtr<TracedValue> urlForTraceEvent(const KURL& url)
292 { 292 {
293 OwnPtr<TracedValue> value = TracedValue::create(); 293 OwnPtr<TracedValue> value = TracedValue::create();
294 value->setString("url", url.getString()); 294 value->setString("url", url.getString());
295 return value.release(); 295 return value;
296 } 296 }
297 297
298 Resource* ResourceFetcher::resourceForStaticData(const FetchRequest& request, co nst ResourceFactory& factory, const SubstituteData& substituteData) 298 Resource* ResourceFetcher::resourceForStaticData(const FetchRequest& request, co nst ResourceFactory& factory, const SubstituteData& substituteData)
299 { 299 {
300 const KURL& url = request.resourceRequest().url(); 300 const KURL& url = request.resourceRequest().url();
301 ASSERT(url.protocolIsData() || substituteData.isValid() || m_archive); 301 ASSERT(url.protocolIsData() || substituteData.isValid() || m_archive);
302 302
303 // TODO(japhet): We only send main resource data: urls through WebURLLoader for the benefit of 303 // TODO(japhet): We only send main resource data: urls through WebURLLoader for the benefit of
304 // a service worker test (RenderViewImplTest.ServiceWorkerNetworkProviderSet up), which is at a 304 // a service worker test (RenderViewImplTest.ServiceWorkerNetworkProviderSet up), which is at a
305 // layer where it isn't easy to mock out a network load. It uses data: urls to emulate the 305 // layer where it isn't easy to mock out a network load. It uses data: urls to emulate the
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 bool isMainResource = resource->getType() == Resource::MainResource; 588 bool isMainResource = resource->getType() == Resource::MainResource;
589 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(fetchInitiator, monotonicallyIncreasingTime(), isMainResource); 589 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(fetchInitiator, monotonicallyIncreasingTime(), isMainResource);
590 590
591 if (resource->isCacheValidator()) { 591 if (resource->isCacheValidator()) {
592 const AtomicString& timingAllowOrigin = resource->response().httpHeaderF ield(HTTPNames::Timing_Allow_Origin); 592 const AtomicString& timingAllowOrigin = resource->response().httpHeaderF ield(HTTPNames::Timing_Allow_Origin);
593 if (!timingAllowOrigin.isEmpty()) 593 if (!timingAllowOrigin.isEmpty())
594 info->setOriginalTimingAllowOrigin(timingAllowOrigin); 594 info->setOriginalTimingAllowOrigin(timingAllowOrigin);
595 } 595 }
596 596
597 if (!isMainResource || context().updateTimingInfoForIFrameNavigation(info.ge t())) 597 if (!isMainResource || context().updateTimingInfoForIFrameNavigation(info.ge t()))
598 m_resourceTimingInfoMap.add(resource, info.release()); 598 m_resourceTimingInfoMap.add(resource, std::move(info));
599 } 599 }
600 600
601 ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy (Resource::Type type, const FetchRequest& fetchRequest, Resource* existingResour ce, bool isStaticData) const 601 ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy (Resource::Type type, const FetchRequest& fetchRequest, Resource* existingResour ce, bool isStaticData) const
602 { 602 {
603 const ResourceRequest& request = fetchRequest.resourceRequest(); 603 const ResourceRequest& request = fetchRequest.resourceRequest();
604 604
605 if (!existingResource) 605 if (!existingResource)
606 return Load; 606 return Load;
607 607
608 // Checks if the resource has an explicit policy about integrity metadata. 608 // Checks if the resource has an explicit policy about integrity metadata.
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 visitor->trace(m_context); 1164 visitor->trace(m_context);
1165 visitor->trace(m_archive); 1165 visitor->trace(m_archive);
1166 visitor->trace(m_loaders); 1166 visitor->trace(m_loaders);
1167 visitor->trace(m_nonBlockingLoaders); 1167 visitor->trace(m_nonBlockingLoaders);
1168 visitor->trace(m_documentResources); 1168 visitor->trace(m_documentResources);
1169 visitor->trace(m_preloads); 1169 visitor->trace(m_preloads);
1170 visitor->trace(m_resourceTimingInfoMap); 1170 visitor->trace(m_resourceTimingInfoMap);
1171 } 1171 }
1172 1172
1173 } // namespace blink 1173 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698