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

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

Issue 23498018: [Resource Timing] Fix potential double free problem (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout test Created 7 years, 3 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
« no previous file with comments | « LayoutTests/http/tests/misc/stop-loading-on-resource-timing-buffer-full-crash-expected.txt ('k') | 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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 RefPtr<Document> protectDocument(m_document); 940 RefPtr<Document> protectDocument(m_document);
941 941
942 if (resource && resource->response().isHTTP() && ((!resource->errorOccurred( ) && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304) && document()) { 942 if (resource && resource->response().isHTTP() && ((!resource->errorOccurred( ) && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304) && document()) {
943 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour ce); 943 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour ce);
944 if (it != m_resourceTimingInfoMap.end()) { 944 if (it != m_resourceTimingInfoMap.end()) {
945 Document* initiatorDocument = document(); 945 Document* initiatorDocument = document();
946 if (resource->type() == Resource::MainResource) 946 if (resource->type() == Resource::MainResource)
947 initiatorDocument = document()->parentDocument(); 947 initiatorDocument = document()->parentDocument();
948 ASSERT(initiatorDocument); 948 ASSERT(initiatorDocument);
949 RefPtr<ResourceTimingInfo> info = it->value; 949 RefPtr<ResourceTimingInfo> info = it->value;
950 m_resourceTimingInfoMap.remove(it);
950 info->setInitialRequest(resource->resourceRequest()); 951 info->setInitialRequest(resource->resourceRequest());
951 info->setFinalResponse(resource->response()); 952 info->setFinalResponse(resource->response());
952 info->setLoadFinishTime(resource->loadFinishTime()); 953 info->setLoadFinishTime(resource->loadFinishTime());
953 if (DOMWindow* initiatorWindow = initiatorDocument->domWindow()) 954 if (DOMWindow* initiatorWindow = initiatorDocument->domWindow())
954 initiatorWindow->performance()->addResourceTiming(*info, initiat orDocument); 955 initiatorWindow->performance()->addResourceTiming(*info, initiat orDocument);
955 m_resourceTimingInfoMap.remove(it);
956 } 956 }
957 } 957 }
958 958
959 if (frame()) 959 if (frame())
960 frame()->loader()->loadDone(); 960 frame()->loader()->loadDone();
961 performPostLoadActions(); 961 performPostLoadActions();
962 962
963 if (!m_garbageCollectDocumentResourcesTimer.isActive()) 963 if (!m_garbageCollectDocumentResourcesTimer.isActive())
964 m_garbageCollectDocumentResourcesTimer.startOneShot(0); 964 m_garbageCollectDocumentResourcesTimer.startOneShot(0);
965 } 965 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } 1287 }
1288 #endif 1288 #endif
1289 1289
1290 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() 1290 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions()
1291 { 1291 {
1292 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul tOriginRestrictionsForType, DocumentContext)); 1292 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul tOriginRestrictionsForType, DocumentContext));
1293 return options; 1293 return options;
1294 } 1294 }
1295 1295
1296 } 1296 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/misc/stop-loading-on-resource-timing-buffer-full-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698