1 /* 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * * Redistributions in binary form must reproduce the above 12 * copyright notice, this list of conditions and the following disclaimer 13 * in the documentation and/or other materials provided with the 14 * distribution. 15 * * Neither the name of Google Inc. nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef PerformanceResourceTiming_h 33 #define PerformanceResourceTiming_h 34 35 #include "core/page/PerformanceEntry.h" 36 #include "wtf/PassRefPtr.h" 37 #include "wtf/RefPtr.h" 38 39 namespace WebCore { 40 41 class Document; 42 class KURL; 43 class ResourceLoadTiming; 44 class ResourceRequest; 45 class ResourceResponse; 46 class ResourceTimingInfo; 47 48 class PerformanceResourceTiming : public PerformanceEntry { 49 public: 50 static PassRefPtr<PerformanceResourceTiming> create(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails) 51 { 52 return adoptRef(new PerformanceResourceTiming(info, requestingDocument, startTime, lastRedirectEndTime, m_allowTimingDetails, m_allowRedirectDetails)); 53 } 54 55 static PassRefPtr<PerformanceResourceTiming> create(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, bool m_allowTimingDetails) 56 { 57 return adoptRef(new PerformanceResourceTiming(info, requestingDocument, startTime, 0.0, m_allowTimingDetails, false)); 58 } 59 60 AtomicString initiatorType() const; 61 62 double redirectStart() const; 63 double redirectEnd() const; 64 double fetchStart() const; 65 double domainLookupStart() const; 66 double domainLookupEnd() const; 67 double connectStart() const; 68 double connectEnd() const; 69 double secureConnectionStart() const; 70 double requestStart() const; 71 double responseStart() const; 72 double responseEnd() const; 73 74 virtual bool isResource() { return true; } 75 76 private: 77 PerformanceResourceTiming(const ResourceTimingInfo&, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails); 78 ~PerformanceResourceTiming(); 79 80 AtomicString m_initiatorType; 81 RefPtr<ResourceLoadTiming> m_timing; 82 double m_lastRedirectEndTime; 83 double m_finishTime; 84 bool m_didReuseConnection; 85 bool m_allowTimingDetails; 86 bool m_allowRedirectDetails; 87 RefPtr<Document> m_requestingDocument; 88 }; 89 90 } 91 92 #endif // !defined(PerformanceResourceTiming_h) 93