| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/quic/quic_http_utils.h" | 5 #include "net/quic/quic_http_utils.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 QuicPriority ConvertRequestPriorityToQuicPriority( | 9 QuicPriority ConvertRequestPriorityToQuicPriority( |
| 10 const RequestPriority priority) { | 10 const RequestPriority priority) { |
| 11 DCHECK_GE(priority, MINIMUM_PRIORITY); | 11 DCHECK_GE(priority, MINIMUM_PRIORITY); |
| 12 DCHECK_LE(priority, MAXIMUM_PRIORITY); | 12 DCHECK_LE(priority, MAXIMUM_PRIORITY); |
| 13 return static_cast<QuicPriority>(HIGHEST - priority); | 13 return static_cast<QuicPriority>(HIGHEST - priority); |
| 14 } | 14 } |
| 15 | 15 |
| 16 NET_EXPORT_PRIVATE RequestPriority ConvertQuicPriorityToRequestPriority( | 16 NET_EXPORT_PRIVATE RequestPriority |
| 17 QuicPriority priority) { | 17 ConvertQuicPriorityToRequestPriority(QuicPriority priority) { |
| 18 // Handle invalid values gracefully. | 18 // Handle invalid values gracefully. |
| 19 return (priority >= 5) ? | 19 return (priority >= 5) ? IDLE |
| 20 IDLE : static_cast<RequestPriority>(HIGHEST - priority); | 20 : static_cast<RequestPriority>(HIGHEST - priority); |
| 21 } | 21 } |
| 22 | 22 |
| 23 base::Value* QuicRequestNetLogCallback( | 23 base::Value* QuicRequestNetLogCallback(QuicStreamId stream_id, |
| 24 QuicStreamId stream_id, | 24 const SpdyHeaderBlock* headers, |
| 25 const SpdyHeaderBlock* headers, | 25 QuicPriority priority, |
| 26 QuicPriority priority, | 26 NetLog::LogLevel log_level) { |
| 27 NetLog::LogLevel log_level) { | |
| 28 base::DictionaryValue* dict = static_cast<base::DictionaryValue*>( | 27 base::DictionaryValue* dict = static_cast<base::DictionaryValue*>( |
| 29 SpdyHeaderBlockNetLogCallback(headers, log_level)); | 28 SpdyHeaderBlockNetLogCallback(headers, log_level)); |
| 30 dict->SetInteger("quic_priority", static_cast<int>(priority)); | 29 dict->SetInteger("quic_priority", static_cast<int>(priority)); |
| 31 dict->SetInteger("quic_stream_id", static_cast<int>(stream_id)); | 30 dict->SetInteger("quic_stream_id", static_cast<int>(stream_id)); |
| 32 return dict; | 31 return dict; |
| 33 } | 32 } |
| 34 | 33 |
| 35 } // namespace net | 34 } // namespace net |
| OLD | NEW |