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

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

Issue 1815383003: Attach requestId to resource fetch trace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « 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 17 matching lines...) Expand all
28 28
29 #include "bindings/core/v8/V8DOMActivityLogger.h" 29 #include "bindings/core/v8/V8DOMActivityLogger.h"
30 #include "core/fetch/CrossOriginAccessControl.h" 30 #include "core/fetch/CrossOriginAccessControl.h"
31 #include "core/fetch/FetchContext.h" 31 #include "core/fetch/FetchContext.h"
32 #include "core/fetch/FetchInitiatorTypeNames.h" 32 #include "core/fetch/FetchInitiatorTypeNames.h"
33 #include "core/fetch/ImageResource.h" 33 #include "core/fetch/ImageResource.h"
34 #include "core/fetch/MemoryCache.h" 34 #include "core/fetch/MemoryCache.h"
35 #include "core/fetch/ResourceLoader.h" 35 #include "core/fetch/ResourceLoader.h"
36 #include "core/fetch/ResourceLoaderSet.h" 36 #include "core/fetch/ResourceLoaderSet.h"
37 #include "core/fetch/UniqueIdentifier.h" 37 #include "core/fetch/UniqueIdentifier.h"
38 #include "core/inspector/IdentifiersFactory.h"
Nate Chapin 2016/03/23 22:43:07 This is a layering violation: core/fetch/ isn't al
38 #include "platform/Histogram.h" 39 #include "platform/Histogram.h"
39 #include "platform/Logging.h" 40 #include "platform/Logging.h"
40 #include "platform/RuntimeEnabledFeatures.h" 41 #include "platform/RuntimeEnabledFeatures.h"
41 #include "platform/TraceEvent.h" 42 #include "platform/TraceEvent.h"
42 #include "platform/TracedValue.h" 43 #include "platform/TracedValue.h"
43 #include "platform/mhtml/ArchiveResource.h" 44 #include "platform/mhtml/ArchiveResource.h"
44 #include "platform/mhtml/MHTMLArchive.h" 45 #include "platform/mhtml/MHTMLArchive.h"
45 #include "platform/network/ResourceTimingInfo.h" 46 #include "platform/network/ResourceTimingInfo.h"
46 #include "platform/weborigin/KnownPorts.h" 47 #include "platform/weborigin/KnownPorts.h"
47 #include "platform/weborigin/SecurityOrigin.h" 48 #include "platform/weborigin/SecurityOrigin.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 m_validatedURLs.add(request.resourceRequest().url()); 293 m_validatedURLs.add(request.resourceRequest().url());
293 } 294 }
294 295
295 static PassOwnPtr<TracedValue> urlForTraceEvent(const KURL& url) 296 static PassOwnPtr<TracedValue> urlForTraceEvent(const KURL& url)
296 { 297 {
297 OwnPtr<TracedValue> value = TracedValue::create(); 298 OwnPtr<TracedValue> value = TracedValue::create();
298 value->setString("url", url.getString()); 299 value->setString("url", url.getString());
299 return value.release(); 300 return value.release();
300 } 301 }
301 302
303 static PassOwnPtr<TracedValue> loadResourceTraceData(unsigned long identifier, c onst KURL& url, int priority)
304 {
305 String requestId = IdentifiersFactory::requestId(identifier);
306
307 OwnPtr<TracedValue> value = TracedValue::create();
308 value->setString("requestId", requestId);
309 value->setString("url", url.getString());
310 value->setInteger("priority", priority);
311 return value.release();
312 }
313
302 PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::resourceForStaticData(const Fe tchRequest& request, const ResourceFactory& factory, const SubstituteData& subst ituteData) 314 PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::resourceForStaticData(const Fe tchRequest& request, const ResourceFactory& factory, const SubstituteData& subst ituteData)
303 { 315 {
304 const KURL& url = request.resourceRequest().url(); 316 const KURL& url = request.resourceRequest().url();
305 ASSERT(url.protocolIsData() || substituteData.isValid()); 317 ASSERT(url.protocolIsData() || substituteData.isValid());
306 318
307 // TODO(japhet): We only send main resource data: urls through WebURLLoader for the benefit of 319 // TODO(japhet): We only send main resource data: urls through WebURLLoader for the benefit of
308 // a service worker test (RenderViewImplTest.ServiceWorkerNetworkProviderSet up), which is at a 320 // a service worker test (RenderViewImplTest.ServiceWorkerNetworkProviderSet up), which is at a
309 // layer where it isn't easy to mock out a network load. It uses data: urls to emulate the 321 // layer where it isn't easy to mock out a network load. It uses data: urls to emulate the
310 // behavior it wants to test, which would otherwise be reserved for network loads. 322 // behavior it wants to test, which would otherwise be reserved for network loads.
311 if ((factory.type() == Resource::MainResource && !substituteData.isValid()) || factory.type() == Resource::Raw) 323 if ((factory.type() == Resource::MainResource && !substituteData.isValid()) || factory.type() == Resource::Raw)
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 m_loaders = ResourceLoaderSet::create(); 1011 m_loaders = ResourceLoaderSet::create();
1000 m_loaders->add(loader); 1012 m_loaders->add(loader);
1001 } else { 1013 } else {
1002 if (!m_nonBlockingLoaders) 1014 if (!m_nonBlockingLoaders)
1003 m_nonBlockingLoaders = ResourceLoaderSet::create(); 1015 m_nonBlockingLoaders = ResourceLoaderSet::create();
1004 m_nonBlockingLoaders->add(loader); 1016 m_nonBlockingLoaders->add(loader);
1005 } 1017 }
1006 1018
1007 context().willStartLoadingResource(request); 1019 context().willStartLoadingResource(request);
1008 storeResourceTimingInitiatorInformation(resource); 1020 storeResourceTimingInitiatorInformation(resource);
1009 TRACE_EVENT_ASYNC_BEGIN2("blink.net", "Resource", resource, "url", resource- >url().getString().ascii(), "priority", resource->resourceRequest().priority()); 1021 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", resource, "data", loadReso urceTraceData(resource->identifier(), resource->url(), resource->resourceRequest ().priority()));
1010 1022
1011 context().dispatchWillSendRequest(resource->identifier(), request, ResourceR esponse(), resource->options().initiatorInfo); 1023 context().dispatchWillSendRequest(resource->identifier(), request, ResourceR esponse(), resource->options().initiatorInfo);
1012 } 1024 }
1013 1025
1014 void ResourceFetcher::removeResourceLoader(ResourceLoader* loader) 1026 void ResourceFetcher::removeResourceLoader(ResourceLoader* loader)
1015 { 1027 {
1016 if (m_loaders && m_loaders->contains(loader)) 1028 if (m_loaders && m_loaders->contains(loader))
1017 m_loaders->remove(loader); 1029 m_loaders->remove(loader);
1018 else if (m_nonBlockingLoaders && m_nonBlockingLoaders->contains(loader)) 1030 else if (m_nonBlockingLoaders && m_nonBlockingLoaders->contains(loader))
1019 m_nonBlockingLoaders->remove(loader); 1031 m_nonBlockingLoaders->remove(loader);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 visitor->trace(m_loaders); 1231 visitor->trace(m_loaders);
1220 visitor->trace(m_nonBlockingLoaders); 1232 visitor->trace(m_nonBlockingLoaders);
1221 #if ENABLE(OILPAN) 1233 #if ENABLE(OILPAN)
1222 visitor->trace(m_documentResources); 1234 visitor->trace(m_documentResources);
1223 visitor->trace(m_preloads); 1235 visitor->trace(m_preloads);
1224 visitor->trace(m_resourceTimingInfoMap); 1236 visitor->trace(m_resourceTimingInfoMap);
1225 #endif 1237 #endif
1226 } 1238 }
1227 1239
1228 } // namespace blink 1240 } // namespace blink
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