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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 transfer_size_ += encoded_data_length; | 97 transfer_size_ += encoded_data_length; |
| 98 } | 98 } |
| 99 long long TransferSize() const { return transfer_size_; } | 99 long long TransferSize() const { return transfer_size_; } |
| 100 | 100 |
| 101 void ClearLoadTimings() { | 101 void ClearLoadTimings() { |
| 102 final_response_.SetResourceLoadTiming(nullptr); | 102 final_response_.SetResourceLoadTiming(nullptr); |
| 103 for (ResourceResponse& redirect : redirect_chain_) | 103 for (ResourceResponse& redirect : redirect_chain_) |
| 104 redirect.SetResourceLoadTiming(nullptr); | 104 redirect.SetResourceLoadTiming(nullptr); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void SetNegativeAllowed(bool negative_allowed) { | |
|
kinuko
2017/04/28 08:26:27
nit: could you add a short comment about this flag
horo
2017/04/28 08:48:11
Done.
| |
| 108 negative_allowed_ = negative_allowed; | |
| 109 } | |
| 110 bool NegativeAllowed() const { return negative_allowed_; } | |
| 111 | |
| 107 private: | 112 private: |
| 108 ResourceTimingInfo(const AtomicString& type, | 113 ResourceTimingInfo(const AtomicString& type, |
| 109 const double time, | 114 const double time, |
| 110 bool is_main_resource) | 115 bool is_main_resource) |
| 111 : type_(type), | 116 : type_(type), initial_time_(time), is_main_resource_(is_main_resource) {} |
| 112 initial_time_(time), | |
| 113 transfer_size_(0), | |
| 114 is_main_resource_(is_main_resource), | |
| 115 has_cross_origin_redirect_(false) {} | |
| 116 | 117 |
| 117 AtomicString type_; | 118 AtomicString type_; |
| 118 AtomicString original_timing_allow_origin_; | 119 AtomicString original_timing_allow_origin_; |
| 119 double initial_time_; | 120 double initial_time_; |
| 120 double load_finish_time_; | 121 double load_finish_time_; |
| 121 KURL initial_url_; | 122 KURL initial_url_; |
| 122 ResourceResponse final_response_; | 123 ResourceResponse final_response_; |
| 123 Vector<ResourceResponse> redirect_chain_; | 124 Vector<ResourceResponse> redirect_chain_; |
| 124 long long transfer_size_; | 125 long long transfer_size_ = 0; |
| 125 bool is_main_resource_; | 126 bool is_main_resource_; |
| 126 bool has_cross_origin_redirect_; | 127 bool has_cross_origin_redirect_ = false; |
| 128 bool negative_allowed_ = false; | |
| 127 }; | 129 }; |
| 128 | 130 |
| 129 struct CrossThreadResourceTimingInfoData { | 131 struct CrossThreadResourceTimingInfoData { |
| 130 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); | 132 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); |
| 131 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); | 133 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); |
| 132 | 134 |
| 133 public: | 135 public: |
| 134 CrossThreadResourceTimingInfoData() {} | 136 CrossThreadResourceTimingInfoData() {} |
| 135 | 137 |
| 136 String type_; | 138 String type_; |
| 137 String original_timing_allow_origin_; | 139 String original_timing_allow_origin_; |
| 138 double initial_time_; | 140 double initial_time_; |
| 139 double load_finish_time_; | 141 double load_finish_time_; |
| 140 KURL initial_url_; | 142 KURL initial_url_; |
| 141 std::unique_ptr<CrossThreadResourceResponseData> final_response_; | 143 std::unique_ptr<CrossThreadResourceResponseData> final_response_; |
| 142 Vector<std::unique_ptr<CrossThreadResourceResponseData>> redirect_chain_; | 144 Vector<std::unique_ptr<CrossThreadResourceResponseData>> redirect_chain_; |
| 143 long long transfer_size_; | 145 long long transfer_size_; |
| 144 bool is_main_resource_; | 146 bool is_main_resource_; |
| 147 bool negative_allowed_; | |
| 145 }; | 148 }; |
| 146 | 149 |
| 147 template <> | 150 template <> |
| 148 struct CrossThreadCopier<ResourceTimingInfo> { | 151 struct CrossThreadCopier<ResourceTimingInfo> { |
| 149 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData>> | 152 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData>> |
| 150 Type; | 153 Type; |
| 151 static Type Copy(const ResourceTimingInfo& info) { | 154 static Type Copy(const ResourceTimingInfo& info) { |
| 152 return WTF::Passed(info.CopyData()); | 155 return WTF::Passed(info.CopyData()); |
| 153 } | 156 } |
| 154 }; | 157 }; |
| 155 | 158 |
| 156 } // namespace blink | 159 } // namespace blink |
| 157 | 160 |
| 158 #endif | 161 #endif |
| OLD | NEW |