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 #include <utility> |
| 8 |
7 namespace net { | 9 namespace net { |
8 | 10 |
9 SpdyPriority ConvertRequestPriorityToQuicPriority( | 11 SpdyPriority ConvertRequestPriorityToQuicPriority( |
10 const RequestPriority priority) { | 12 const RequestPriority priority) { |
11 DCHECK_GE(priority, MINIMUM_PRIORITY); | 13 DCHECK_GE(priority, MINIMUM_PRIORITY); |
12 DCHECK_LE(priority, MAXIMUM_PRIORITY); | 14 DCHECK_LE(priority, MAXIMUM_PRIORITY); |
13 return static_cast<SpdyPriority>(HIGHEST - priority); | 15 return static_cast<SpdyPriority>(HIGHEST - priority); |
14 } | 16 } |
15 | 17 |
16 NET_EXPORT_PRIVATE RequestPriority | 18 NET_EXPORT_PRIVATE RequestPriority |
17 ConvertQuicPriorityToRequestPriority(SpdyPriority priority) { | 19 ConvertQuicPriorityToRequestPriority(SpdyPriority priority) { |
18 // Handle invalid values gracefully. | 20 // Handle invalid values gracefully. |
19 return (priority >= 5) ? IDLE | 21 return (priority >= 5) ? IDLE |
20 : static_cast<RequestPriority>(HIGHEST - priority); | 22 : static_cast<RequestPriority>(HIGHEST - priority); |
21 } | 23 } |
22 | 24 |
23 scoped_ptr<base::Value> QuicRequestNetLogCallback( | 25 scoped_ptr<base::Value> QuicRequestNetLogCallback( |
24 QuicStreamId stream_id, | 26 QuicStreamId stream_id, |
25 const SpdyHeaderBlock* headers, | 27 const SpdyHeaderBlock* headers, |
26 SpdyPriority priority, | 28 SpdyPriority priority, |
27 NetLogCaptureMode capture_mode) { | 29 NetLogCaptureMode capture_mode) { |
28 scoped_ptr<base::DictionaryValue> dict(static_cast<base::DictionaryValue*>( | 30 scoped_ptr<base::DictionaryValue> dict(static_cast<base::DictionaryValue*>( |
29 SpdyHeaderBlockNetLogCallback(headers, capture_mode).release())); | 31 SpdyHeaderBlockNetLogCallback(headers, capture_mode).release())); |
30 dict->SetInteger("quic_priority", static_cast<int>(priority)); | 32 dict->SetInteger("quic_priority", static_cast<int>(priority)); |
31 dict->SetInteger("quic_stream_id", static_cast<int>(stream_id)); | 33 dict->SetInteger("quic_stream_id", static_cast<int>(stream_id)); |
32 return dict.Pass(); | 34 return std::move(dict); |
33 } | 35 } |
34 | 36 |
35 } // namespace net | 37 } // namespace net |
OLD | NEW |