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

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

Issue 1987013002: Add UMA to track time between preload discovery and reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@preload_timing_uma
Patch Set: Include preloads generated by LinkLoader 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) 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 rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
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 15 matching lines...) Expand all
26 #include "core/fetch/CachedMetadata.h" 26 #include "core/fetch/CachedMetadata.h"
27 #include "core/fetch/CrossOriginAccessControl.h" 27 #include "core/fetch/CrossOriginAccessControl.h"
28 #include "core/fetch/FetchInitiatorTypeNames.h" 28 #include "core/fetch/FetchInitiatorTypeNames.h"
29 #include "core/fetch/MemoryCache.h" 29 #include "core/fetch/MemoryCache.h"
30 #include "core/fetch/ResourceClient.h" 30 #include "core/fetch/ResourceClient.h"
31 #include "core/fetch/ResourceClientOrObserverWalker.h" 31 #include "core/fetch/ResourceClientOrObserverWalker.h"
32 #include "core/fetch/ResourceFetcher.h" 32 #include "core/fetch/ResourceFetcher.h"
33 #include "core/fetch/ResourceLoader.h" 33 #include "core/fetch/ResourceLoader.h"
34 #include "core/inspector/InspectorInstrumentation.h" 34 #include "core/inspector/InspectorInstrumentation.h"
35 #include "core/inspector/InstanceCounters.h" 35 #include "core/inspector/InstanceCounters.h"
36 #include "platform/Histogram.h"
36 #include "platform/Logging.h" 37 #include "platform/Logging.h"
37 #include "platform/SharedBuffer.h" 38 #include "platform/SharedBuffer.h"
38 #include "platform/TraceEvent.h" 39 #include "platform/TraceEvent.h"
39 #include "platform/network/HTTPParsers.h" 40 #include "platform/network/HTTPParsers.h"
40 #include "platform/weborigin/KURL.h" 41 #include "platform/weborigin/KURL.h"
41 #include "public/platform/Platform.h" 42 #include "public/platform/Platform.h"
42 #include "public/platform/WebProcessMemoryDump.h" 43 #include "public/platform/WebProcessMemoryDump.h"
43 #include "public/platform/WebScheduler.h" 44 #include "public/platform/WebScheduler.h"
44 #include "public/platform/WebSecurityOrigin.h" 45 #include "public/platform/WebSecurityOrigin.h"
45 #include "wtf/CurrentTime.h" 46 #include "wtf/CurrentTime.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 : m_resourceRequest(request) 297 : m_resourceRequest(request)
297 , m_options(options) 298 , m_options(options)
298 , m_responseTimestamp(currentTime()) 299 , m_responseTimestamp(currentTime())
299 , m_cancelTimer(this, &Resource::cancelTimerFired) 300 , m_cancelTimer(this, &Resource::cancelTimerFired)
300 , m_loadFinishTime(0) 301 , m_loadFinishTime(0)
301 , m_identifier(0) 302 , m_identifier(0)
302 , m_encodedSize(0) 303 , m_encodedSize(0)
303 , m_decodedSize(0) 304 , m_decodedSize(0)
304 , m_overheadSize(calculateOverheadSize()) 305 , m_overheadSize(calculateOverheadSize())
305 , m_preloadCount(0) 306 , m_preloadCount(0)
307 , m_preloadDiscoveryTime(0.0)
306 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()) 308 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier())
307 , m_preloadResult(PreloadNotReferenced) 309 , m_preloadResult(PreloadNotReferenced)
308 , m_type(type) 310 , m_type(type)
309 , m_status(NotStarted) 311 , m_status(NotStarted)
310 , m_needsSynchronousCacheHit(false) 312 , m_needsSynchronousCacheHit(false)
311 , m_linkPreload(false) 313 , m_linkPreload(false)
312 { 314 {
313 ThreadState::current()->registerPreFinalizer(this); 315 ThreadState::current()->registerPreFinalizer(this);
314 316
315 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car eless updates of the enum. 317 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car eless updates of the enum.
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 void Resource::willAddClientOrObserver() 688 void Resource::willAddClientOrObserver()
687 { 689 {
688 ASSERT(!isPurgeable()); 690 ASSERT(!isPurgeable());
689 if (m_preloadResult == PreloadNotReferenced) { 691 if (m_preloadResult == PreloadNotReferenced) {
690 if (isLoaded()) 692 if (isLoaded())
691 m_preloadResult = PreloadReferencedWhileComplete; 693 m_preloadResult = PreloadReferencedWhileComplete;
692 else if (isLoading()) 694 else if (isLoading())
693 m_preloadResult = PreloadReferencedWhileLoading; 695 m_preloadResult = PreloadReferencedWhileLoading;
694 else 696 else
695 m_preloadResult = PreloadReferenced; 697 m_preloadResult = PreloadReferenced;
698
699 if (m_preloadDiscoveryTime) {
700 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre asingTime() - m_preloadDiscoveryTime));
701 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram, ("PreloadScanner.ReferenceTime", 0, 10000, 50));
702 preloadDiscoveryHistogram.count(timeSinceDiscovery);
703 }
696 } 704 }
697 if (!hasClientsOrObservers()) 705 if (!hasClientsOrObservers())
698 memoryCache()->makeLive(this); 706 memoryCache()->makeLive(this);
699 } 707 }
700 708
701 void Resource::addClient(ResourceClient* client) 709 void Resource::addClient(ResourceClient* client)
702 { 710 {
703 willAddClientOrObserver(); 711 willAddClientOrObserver();
704 712
705 if (!m_revalidatingRequest.isNull()) { 713 if (!m_revalidatingRequest.isNull()) {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 case Resource::Media: 1138 case Resource::Media:
1131 return "Media"; 1139 return "Media";
1132 case Resource::Manifest: 1140 case Resource::Manifest:
1133 return "Manifest"; 1141 return "Manifest";
1134 } 1142 }
1135 ASSERT_NOT_REACHED(); 1143 ASSERT_NOT_REACHED();
1136 return "Unknown"; 1144 return "Unknown";
1137 } 1145 }
1138 1146
1139 } // namespace blink 1147 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698