1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef WebURLLoadTiming_h 32 #define WebURLLoadTiming_h 33 34 #include "WebCommon.h" 35 #include "WebPrivatePtr.h" 36 37 namespace WebCore { class ResourceLoadTiming; } 38 39 namespace WebKit { 40 class WebString; 41 42 class WebURLLoadTiming { 43 public: ~WebURLLoadTiming()44 ~WebURLLoadTiming() { reset(); } 45 WebURLLoadTiming()46 WebURLLoadTiming() { } WebURLLoadTiming(const WebURLLoadTiming & d)47 WebURLLoadTiming(const WebURLLoadTiming& d) { assign(d); } 48 WebURLLoadTiming& operator=(const WebURLLoadTiming& d) 49 { 50 assign(d); 51 return *this; 52 } 53 54 WEBKIT_API void initialize(); 55 WEBKIT_API void reset(); 56 WEBKIT_API void assign(const WebURLLoadTiming&); 57 isNull()58 bool isNull() const { return m_private.isNull(); } 59 60 WEBKIT_API double requestTime() const; 61 WEBKIT_API void setRequestTime(double time); 62 63 WEBKIT_API int proxyStart() const; 64 WEBKIT_API void setProxyStart(int start); 65 66 WEBKIT_API int proxyEnd() const; 67 WEBKIT_API void setProxyEnd(int end); 68 69 WEBKIT_API int dnsStart() const; 70 WEBKIT_API void setDNSStart(int start); 71 72 WEBKIT_API int dnsEnd() const; 73 WEBKIT_API void setDNSEnd(int end); 74 75 WEBKIT_API int connectStart() const; 76 WEBKIT_API void setConnectStart(int start); 77 78 WEBKIT_API int connectEnd() const; 79 WEBKIT_API void setConnectEnd(int end); 80 81 WEBKIT_API int sendStart() const; 82 WEBKIT_API void setSendStart(int start); 83 84 WEBKIT_API int sendEnd() const; 85 WEBKIT_API void setSendEnd(int end); 86 87 WEBKIT_API int receiveHeadersEnd() const; 88 WEBKIT_API void setReceiveHeadersEnd(int end); 89 90 WEBKIT_API int sslStart() const; 91 WEBKIT_API void setSSLStart(int start); 92 93 WEBKIT_API int sslEnd() const; 94 WEBKIT_API void setSSLEnd(int end); 95 96 #if WEBKIT_IMPLEMENTATION 97 WebURLLoadTiming(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); 98 WebURLLoadTiming& operator=(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); 99 operator WTF::PassRefPtr<WebCore::ResourceLoadTiming>() const; 100 #endif 101 102 private: 103 WebPrivatePtr<WebCore::ResourceLoadTiming> m_private; 104 }; 105 106 } // namespace WebKit 107 108 #endif 109