| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Intel Inc. All rights reserved. | 2 * Copyright (C) 2013 Intel Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ResourceTimingInfo_h | 31 #ifndef ResourceTimingInfo_h |
| 32 #define ResourceTimingInfo_h | 32 #define ResourceTimingInfo_h |
| 33 | 33 |
| 34 #include "platform/CrossThreadCopier.h" |
| 34 #include "platform/network/ResourceRequest.h" | 35 #include "platform/network/ResourceRequest.h" |
| 35 #include "platform/network/ResourceResponse.h" | 36 #include "platform/network/ResourceResponse.h" |
| 36 #include "wtf/text/AtomicString.h" | 37 #include "wtf/text/AtomicString.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class ResourceTimingInfo { | 41 struct CrossThreadResourceTimingInfoData; |
| 42 |
| 43 class PLATFORM_EXPORT ResourceTimingInfo { |
| 41 public: | 44 public: |
| 42 static PassOwnPtr<ResourceTimingInfo> create(const AtomicString& type, const
double time, bool isMainResource) | 45 static PassOwnPtr<ResourceTimingInfo> create(const AtomicString& type, const
double time, bool isMainResource) |
| 43 { | 46 { |
| 44 return adoptPtr(new ResourceTimingInfo(type, time, isMainResource)); | 47 return adoptPtr(new ResourceTimingInfo(type, time, isMainResource)); |
| 45 } | 48 } |
| 49 static PassOwnPtr<ResourceTimingInfo> adopt(PassOwnPtr<CrossThreadResourceTi
mingInfoData>); |
| 50 |
| 51 // Gets a copy of the data suitable for passing to another thread. |
| 52 PassOwnPtr<CrossThreadResourceTimingInfoData> copyData() const; |
| 46 | 53 |
| 47 double initialTime() const { return m_initialTime; } | 54 double initialTime() const { return m_initialTime; } |
| 48 bool isMainResource() const { return m_isMainResource; } | 55 bool isMainResource() const { return m_isMainResource; } |
| 49 | 56 |
| 50 void setInitiatorType(const AtomicString& type) { m_type = type; } | 57 void setInitiatorType(const AtomicString& type) { m_type = type; } |
| 51 const AtomicString& initiatorType() const { return m_type; } | 58 const AtomicString& initiatorType() const { return m_type; } |
| 52 | 59 |
| 53 void setOriginalTimingAllowOrigin(const AtomicString& originalTimingAllowOri
gin) { m_originalTimingAllowOrigin = originalTimingAllowOrigin; } | 60 void setOriginalTimingAllowOrigin(const AtomicString& originalTimingAllowOri
gin) { m_originalTimingAllowOrigin = originalTimingAllowOrigin; } |
| 54 const AtomicString& originalTimingAllowOrigin() const { return m_originalTim
ingAllowOrigin; } | 61 const AtomicString& originalTimingAllowOrigin() const { return m_originalTim
ingAllowOrigin; } |
| 55 | 62 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 AtomicString m_type; | 90 AtomicString m_type; |
| 84 AtomicString m_originalTimingAllowOrigin; | 91 AtomicString m_originalTimingAllowOrigin; |
| 85 double m_initialTime; | 92 double m_initialTime; |
| 86 double m_loadFinishTime; | 93 double m_loadFinishTime; |
| 87 ResourceRequest m_initialRequest; | 94 ResourceRequest m_initialRequest; |
| 88 ResourceResponse m_finalResponse; | 95 ResourceResponse m_finalResponse; |
| 89 Vector<ResourceResponse> m_redirectChain; | 96 Vector<ResourceResponse> m_redirectChain; |
| 90 bool m_isMainResource; | 97 bool m_isMainResource; |
| 91 }; | 98 }; |
| 92 | 99 |
| 100 struct CrossThreadResourceTimingInfoData { |
| 101 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); |
| 102 WTF_MAKE_FAST_ALLOCATED(CrossThreadResourceTimingInfoData); |
| 103 public: |
| 104 CrossThreadResourceTimingInfoData() {} |
| 105 |
| 106 String m_type; |
| 107 String m_originalTimingAllowOrigin; |
| 108 double m_initialTime; |
| 109 double m_loadFinishTime; |
| 110 OwnPtr<CrossThreadResourceRequestData> m_initialRequest; |
| 111 OwnPtr<CrossThreadResourceResponseData> m_finalResponse; |
| 112 Vector<OwnPtr<CrossThreadResourceResponseData>> m_redirectChain; |
| 113 bool m_isMainResource; |
| 114 }; |
| 115 |
| 116 template<> struct CrossThreadCopierBase<false, false, false, ResourceTimingInfo>
{ |
| 117 typedef PassOwnPtr<CrossThreadResourceTimingInfoData> Type; |
| 118 static Type copy(const ResourceTimingInfo& info) { return info.copyData(); } |
| 119 }; |
| 120 |
| 93 } // namespace blink | 121 } // namespace blink |
| 94 | 122 |
| 95 #endif | 123 #endif |
| OLD | NEW |