Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/network/ResourceTimingInfo.h" | 5 #include "platform/network/ResourceTimingInfo.h" |
| 6 | 6 |
| 7 #include "platform/CrossThreadCopier.h" | 7 #include "platform/CrossThreadCopier.h" |
| 8 #include "wtf/PtrUtil.h" | 8 #include "wtf/PtrUtil.h" |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 { | 26 { |
| 27 std::unique_ptr<CrossThreadResourceTimingInfoData> data = wrapUnique(new Cro ssThreadResourceTimingInfoData); | 27 std::unique_ptr<CrossThreadResourceTimingInfoData> data = wrapUnique(new Cro ssThreadResourceTimingInfoData); |
| 28 data->m_type = m_type.getString().isolatedCopy(); | 28 data->m_type = m_type.getString().isolatedCopy(); |
| 29 data->m_originalTimingAllowOrigin = m_originalTimingAllowOrigin.getString(). isolatedCopy(); | 29 data->m_originalTimingAllowOrigin = m_originalTimingAllowOrigin.getString(). isolatedCopy(); |
| 30 data->m_initialTime = m_initialTime; | 30 data->m_initialTime = m_initialTime; |
| 31 data->m_loadFinishTime = m_loadFinishTime; | 31 data->m_loadFinishTime = m_loadFinishTime; |
| 32 data->m_initialRequest = m_initialRequest.copyData(); | 32 data->m_initialRequest = m_initialRequest.copyData(); |
| 33 data->m_finalResponse = m_finalResponse.copyData(); | 33 data->m_finalResponse = m_finalResponse.copyData(); |
| 34 for (const auto& response : m_redirectChain) | 34 for (const auto& response : m_redirectChain) |
| 35 data->m_redirectChain.append(response.copyData()); | 35 data->m_redirectChain.append(response.copyData()); |
| 36 data->m_transferSize = m_transferSize; | |
| 36 data->m_isMainResource = m_isMainResource; | 37 data->m_isMainResource = m_isMainResource; |
| 37 return data; | 38 return data; |
| 38 } | 39 } |
| 39 | 40 |
| 41 void ResourceTimingInfo::addRedirect(const ResourceResponse& redirectResponse, l ong long encodedDataLength, bool crossOrigin) | |
| 42 { | |
| 43 m_redirectChain.append(redirectResponse); | |
| 44 if (crossOrigin && !m_hasCrossOriginRedirect) { | |
|
Kunihiko Sakamoto
2016/07/01 10:12:35
Early return if m_hasCrossOriginRedirect is true?
Adam Rice
2016/07/04 02:44:18
Done, thanks.
| |
| 45 m_hasCrossOriginRedirect = true; | |
| 46 m_transferSize = 0; | |
| 47 } else if (!m_hasCrossOriginRedirect) { | |
| 48 DCHECK_GE(encodedDataLength, 0); | |
| 49 m_transferSize += encodedDataLength; | |
| 50 } | |
| 51 } | |
| 52 | |
| 40 } // namespace blink | 53 } // namespace blink |
| OLD | NEW |