Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / quic / quic_http_utils.cc
blob60fbd9a4a7f7371fa454b920f4c84aa7ee727bf4
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
3 // found in the LICENSE file.
5 #include "net/quic/quic_http_utils.h"
7 namespace net {
9 QuicPriority ConvertRequestPriorityToQuicPriority(
10 const RequestPriority priority) {
11 DCHECK_GE(priority, MINIMUM_PRIORITY);
12 DCHECK_LE(priority, MAXIMUM_PRIORITY);
13 return static_cast<QuicPriority>(HIGHEST - priority);
16 NET_EXPORT_PRIVATE RequestPriority ConvertQuicPriorityToRequestPriority(
17 QuicPriority priority) {
18 // Handle invalid values gracefully.
19 return (priority >= 5) ?
20 IDLE : static_cast<RequestPriority>(HIGHEST - priority);
23 scoped_ptr<base::Value> QuicRequestNetLogCallback(
24 QuicStreamId stream_id,
25 const SpdyHeaderBlock* headers,
26 QuicPriority priority,
27 NetLogCaptureMode capture_mode) {
28 scoped_ptr<base::DictionaryValue> dict(static_cast<base::DictionaryValue*>(
29 SpdyHeaderBlockNetLogCallback(headers, capture_mode).release()));
30 dict->SetInteger("quic_priority", static_cast<int>(priority));
31 dict->SetInteger("quic_stream_id", static_cast<int>(stream_id));
32 return dict.Pass();
35 } // namespace net