Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 // Gets a copy of the data suitable for passing to another thread. | 61 // Gets a copy of the data suitable for passing to another thread. |
| 62 std::unique_ptr<CrossThreadResourceTimingInfoData> copyData() const; | 62 std::unique_ptr<CrossThreadResourceTimingInfoData> copyData() const; |
| 63 | 63 |
| 64 double initialTime() const { return m_initialTime; } | 64 double initialTime() const { return m_initialTime; } |
| 65 bool isMainResource() const { return m_isMainResource; } | 65 bool isMainResource() const { return m_isMainResource; } |
| 66 | 66 |
| 67 void setInitiatorType(const AtomicString& type) { m_type = type; } | 67 void setInitiatorType(const AtomicString& type) { m_type = type; } |
| 68 const AtomicString& initiatorType() const { return m_type; } | 68 const AtomicString& initiatorType() const { return m_type; } |
| 69 | 69 |
| 70 /*void setNextHopProtocol(const AtomicString& nextHopProtocol) { | |
|
panicker
2016/10/19 00:25:11
why is this commented out?
Remove if not needed
sunjian
2016/10/21 00:19:50
Done.
| |
| 71 m_nextHopProtocol = nextHopProtocol; | |
| 72 }*/ | |
| 73 const AtomicString& nextHopProtocol() const { return m_nextHopProtocol; } | |
| 74 | |
| 70 void setOriginalTimingAllowOrigin( | 75 void setOriginalTimingAllowOrigin( |
| 71 const AtomicString& originalTimingAllowOrigin) { | 76 const AtomicString& originalTimingAllowOrigin) { |
| 72 m_originalTimingAllowOrigin = originalTimingAllowOrigin; | 77 m_originalTimingAllowOrigin = originalTimingAllowOrigin; |
| 73 } | 78 } |
| 74 const AtomicString& originalTimingAllowOrigin() const { | 79 const AtomicString& originalTimingAllowOrigin() const { |
| 75 return m_originalTimingAllowOrigin; | 80 return m_originalTimingAllowOrigin; |
| 76 } | 81 } |
| 77 | 82 |
| 78 void setLoadFinishTime(double time) { m_loadFinishTime = time; } | 83 void setLoadFinishTime(double time) { m_loadFinishTime = time; } |
| 79 double loadFinishTime() const { return m_loadFinishTime; } | 84 double loadFinishTime() const { return m_loadFinishTime; } |
| 80 | 85 |
| 81 void setInitialURL(const KURL& url) { m_initialURL = url; } | 86 void setInitialURL(const KURL& url) { m_initialURL = url; } |
| 82 const KURL& initialURL() const { return m_initialURL; } | 87 const KURL& initialURL() const { return m_initialURL; } |
| 83 | 88 |
| 84 void setFinalResponse(const ResourceResponse& response) { | 89 void setFinalResponse(const ResourceResponse& response) { |
| 85 m_finalResponse = response; | 90 m_finalResponse = response; |
| 91 m_nextHopProtocol = response.alpnNegotiatedProtocol(); | |
| 86 } | 92 } |
| 87 const ResourceResponse& finalResponse() const { return m_finalResponse; } | 93 const ResourceResponse& finalResponse() const { return m_finalResponse; } |
| 88 | 94 |
| 89 void addRedirect(const ResourceResponse& redirectResponse, bool crossOrigin); | 95 void addRedirect(const ResourceResponse& redirectResponse, bool crossOrigin); |
| 90 const Vector<ResourceResponse>& redirectChain() const { | 96 const Vector<ResourceResponse>& redirectChain() const { |
| 91 return m_redirectChain; | 97 return m_redirectChain; |
| 92 } | 98 } |
| 93 | 99 |
| 94 void addFinalTransferSize(long long encodedDataLength) { | 100 void addFinalTransferSize(long long encodedDataLength) { |
| 95 m_transferSize += encodedDataLength; | 101 m_transferSize += encodedDataLength; |
| 96 } | 102 } |
| 97 long long transferSize() const { return m_transferSize; } | 103 long long transferSize() const { return m_transferSize; } |
| 98 | 104 |
| 99 void clearLoadTimings() { | 105 void clearLoadTimings() { |
| 100 m_finalResponse.setResourceLoadTiming(nullptr); | 106 m_finalResponse.setResourceLoadTiming(nullptr); |
| 101 for (ResourceResponse& redirect : m_redirectChain) | 107 for (ResourceResponse& redirect : m_redirectChain) |
| 102 redirect.setResourceLoadTiming(nullptr); | 108 redirect.setResourceLoadTiming(nullptr); |
| 103 } | 109 } |
| 104 | 110 |
| 105 private: | 111 private: |
| 106 ResourceTimingInfo(const AtomicString& type, | 112 ResourceTimingInfo(const AtomicString& type, |
| 107 const double time, | 113 const double time, |
| 108 bool isMainResource) | 114 bool isMainResource) |
| 109 : m_type(type), | 115 : m_type(type), |
| 116 m_nextHopProtocol(""), | |
| 110 m_initialTime(time), | 117 m_initialTime(time), |
| 111 m_transferSize(0), | 118 m_transferSize(0), |
| 112 m_isMainResource(isMainResource), | 119 m_isMainResource(isMainResource), |
| 113 m_hasCrossOriginRedirect(false) {} | 120 m_hasCrossOriginRedirect(false) {} |
| 114 | 121 |
| 115 AtomicString m_type; | 122 AtomicString m_type; |
| 123 AtomicString m_nextHopProtocol; | |
| 116 AtomicString m_originalTimingAllowOrigin; | 124 AtomicString m_originalTimingAllowOrigin; |
| 117 double m_initialTime; | 125 double m_initialTime; |
| 118 double m_loadFinishTime; | 126 double m_loadFinishTime; |
| 119 KURL m_initialURL; | 127 KURL m_initialURL; |
| 120 ResourceResponse m_finalResponse; | 128 ResourceResponse m_finalResponse; |
| 121 Vector<ResourceResponse> m_redirectChain; | 129 Vector<ResourceResponse> m_redirectChain; |
| 122 long long m_transferSize; | 130 long long m_transferSize; |
| 123 bool m_isMainResource; | 131 bool m_isMainResource; |
| 124 bool m_hasCrossOriginRedirect; | 132 bool m_hasCrossOriginRedirect; |
| 125 }; | 133 }; |
| 126 | 134 |
| 127 struct CrossThreadResourceTimingInfoData { | 135 struct CrossThreadResourceTimingInfoData { |
| 128 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); | 136 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); |
| 129 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); | 137 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); |
| 130 | 138 |
| 131 public: | 139 public: |
| 132 CrossThreadResourceTimingInfoData() {} | 140 CrossThreadResourceTimingInfoData() {} |
| 133 | 141 |
| 134 String m_type; | 142 String m_type; |
| 143 String m_nextHopProtocol; | |
| 135 String m_originalTimingAllowOrigin; | 144 String m_originalTimingAllowOrigin; |
| 136 double m_initialTime; | 145 double m_initialTime; |
| 137 double m_loadFinishTime; | 146 double m_loadFinishTime; |
| 138 KURL m_initialURL; | 147 KURL m_initialURL; |
| 139 std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse; | 148 std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse; |
| 140 Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain; | 149 Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain; |
| 141 long long m_transferSize; | 150 long long m_transferSize; |
| 142 bool m_isMainResource; | 151 bool m_isMainResource; |
| 143 }; | 152 }; |
| 144 | 153 |
| 145 template <> | 154 template <> |
| 146 struct CrossThreadCopier<ResourceTimingInfo> { | 155 struct CrossThreadCopier<ResourceTimingInfo> { |
| 147 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData>> | 156 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData>> |
| 148 Type; | 157 Type; |
| 149 static Type copy(const ResourceTimingInfo& info) { | 158 static Type copy(const ResourceTimingInfo& info) { |
| 150 return passed(info.copyData()); | 159 return passed(info.copyData()); |
| 151 } | 160 } |
| 152 }; | 161 }; |
| 153 | 162 |
| 154 } // namespace blink | 163 } // namespace blink |
| 155 | 164 |
| 156 #endif | 165 #endif |
| OLD | NEW |