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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 void setInitiatorType(const AtomicString& type) { m_type = type; } | 64 void setInitiatorType(const AtomicString& type) { m_type = type; } |
65 const AtomicString& initiatorType() const { return m_type; } | 65 const AtomicString& initiatorType() const { return m_type; } |
66 | 66 |
67 void setOriginalTimingAllowOrigin(const AtomicString& originalTimingAllowOri
gin) { m_originalTimingAllowOrigin = originalTimingAllowOrigin; } | 67 void setOriginalTimingAllowOrigin(const AtomicString& originalTimingAllowOri
gin) { m_originalTimingAllowOrigin = originalTimingAllowOrigin; } |
68 const AtomicString& originalTimingAllowOrigin() const { return m_originalTim
ingAllowOrigin; } | 68 const AtomicString& originalTimingAllowOrigin() const { return m_originalTim
ingAllowOrigin; } |
69 | 69 |
70 void setLoadFinishTime(double time) { m_loadFinishTime = time; } | 70 void setLoadFinishTime(double time) { m_loadFinishTime = time; } |
71 double loadFinishTime() const { return m_loadFinishTime; } | 71 double loadFinishTime() const { return m_loadFinishTime; } |
72 | 72 |
73 void setInitialRequest(const ResourceRequest& request) { m_initialRequest =
request; } | 73 void setInitialURL(const KURL& url) { m_initialURL = url; } |
74 const ResourceRequest& initialRequest() const { return m_initialRequest; } | 74 const KURL& initialURL() const { return m_initialURL; } |
75 | 75 |
76 void setFinalResponse(const ResourceResponse& response) { m_finalResponse =
response; } | 76 void setFinalResponse(const ResourceResponse& response) { m_finalResponse =
response; } |
77 const ResourceResponse& finalResponse() const { return m_finalResponse; } | 77 const ResourceResponse& finalResponse() const { return m_finalResponse; } |
78 | 78 |
79 void addRedirect(const ResourceResponse& redirectResponse, long long encoded
DataLength, bool crossOrigin); | 79 void addRedirect(const ResourceResponse& redirectResponse, bool crossOrigin)
; |
80 const Vector<ResourceResponse>& redirectChain() const { return m_redirectCha
in; } | 80 const Vector<ResourceResponse>& redirectChain() const { return m_redirectCha
in; } |
81 | 81 |
82 void addFinalTransferSize(long long encodedDataLength) { m_transferSize += e
ncodedDataLength; } | 82 void addFinalTransferSize(long long encodedDataLength) { m_transferSize += e
ncodedDataLength; } |
83 long long transferSize() const { return m_transferSize; } | 83 long long transferSize() const { return m_transferSize; } |
84 | 84 |
85 void clearLoadTimings() | 85 void clearLoadTimings() |
86 { | 86 { |
87 m_finalResponse.setResourceLoadTiming(nullptr); | 87 m_finalResponse.setResourceLoadTiming(nullptr); |
88 for (ResourceResponse& redirect : m_redirectChain) | 88 for (ResourceResponse& redirect : m_redirectChain) |
89 redirect.setResourceLoadTiming(nullptr); | 89 redirect.setResourceLoadTiming(nullptr); |
90 } | 90 } |
91 | 91 |
92 private: | 92 private: |
93 ResourceTimingInfo(const AtomicString& type, const double time, bool isMainR
esource) | 93 ResourceTimingInfo(const AtomicString& type, const double time, bool isMainR
esource) |
94 : m_type(type) | 94 : m_type(type) |
95 , m_initialTime(time) | 95 , m_initialTime(time) |
96 , m_transferSize(0) | 96 , m_transferSize(0) |
97 , m_isMainResource(isMainResource) | 97 , m_isMainResource(isMainResource) |
98 , m_hasCrossOriginRedirect(false) | 98 , m_hasCrossOriginRedirect(false) |
99 { | 99 { |
100 } | 100 } |
101 | 101 |
102 AtomicString m_type; | 102 AtomicString m_type; |
103 AtomicString m_originalTimingAllowOrigin; | 103 AtomicString m_originalTimingAllowOrigin; |
104 double m_initialTime; | 104 double m_initialTime; |
105 double m_loadFinishTime; | 105 double m_loadFinishTime; |
106 ResourceRequest m_initialRequest; | 106 KURL m_initialURL; |
107 ResourceResponse m_finalResponse; | 107 ResourceResponse m_finalResponse; |
108 Vector<ResourceResponse> m_redirectChain; | 108 Vector<ResourceResponse> m_redirectChain; |
109 long long m_transferSize; | 109 long long m_transferSize; |
110 bool m_isMainResource; | 110 bool m_isMainResource; |
111 bool m_hasCrossOriginRedirect; | 111 bool m_hasCrossOriginRedirect; |
112 }; | 112 }; |
113 | 113 |
114 struct CrossThreadResourceTimingInfoData { | 114 struct CrossThreadResourceTimingInfoData { |
115 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); | 115 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); |
116 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); | 116 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); |
117 public: | 117 public: |
118 CrossThreadResourceTimingInfoData() {} | 118 CrossThreadResourceTimingInfoData() {} |
119 | 119 |
120 String m_type; | 120 String m_type; |
121 String m_originalTimingAllowOrigin; | 121 String m_originalTimingAllowOrigin; |
122 double m_initialTime; | 122 double m_initialTime; |
123 double m_loadFinishTime; | 123 double m_loadFinishTime; |
124 std::unique_ptr<CrossThreadResourceRequestData> m_initialRequest; | 124 KURL m_initialURL; |
125 std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse; | 125 std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse; |
126 Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain; | 126 Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain; |
127 long long m_transferSize; | 127 long long m_transferSize; |
128 bool m_isMainResource; | 128 bool m_isMainResource; |
129 }; | 129 }; |
130 | 130 |
131 template <> | 131 template <> |
132 struct CrossThreadCopier<ResourceTimingInfo> { | 132 struct CrossThreadCopier<ResourceTimingInfo> { |
133 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData
>> Type; | 133 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData
>> Type; |
134 static Type copy(const ResourceTimingInfo& info) { return passed(info.copyDa
ta()); } | 134 static Type copy(const ResourceTimingInfo& info) { return passed(info.copyDa
ta()); } |
135 }; | 135 }; |
136 | 136 |
137 } // namespace blink | 137 } // namespace blink |
138 | 138 |
139 #endif | 139 #endif |
OLD | NEW |