OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_client_push_promise_index.h" | 5 #include "net/quic/quic_client_push_promise_index.h" |
6 | 6 |
7 #include "net/quic/quic_client_promised_info.h" | 7 #include "net/quic/quic_client_promised_info.h" |
8 #include "net/quic/spdy_utils.h" | 8 #include "net/quic/spdy_utils.h" |
9 | 9 |
10 using net::SpdyHeaderBlock; | 10 using net::SpdyHeaderBlock; |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 QuicClientPushPromiseIndex::QuicClientPushPromiseIndex() {} | 14 QuicClientPushPromiseIndex::QuicClientPushPromiseIndex() {} |
15 | 15 |
16 QuicClientPushPromiseIndex::~QuicClientPushPromiseIndex() {} | 16 QuicClientPushPromiseIndex::~QuicClientPushPromiseIndex() {} |
17 | 17 |
18 QuicClientPushPromiseIndex::TryHandle::~TryHandle() {} | 18 QuicClientPushPromiseIndex::TryHandle::~TryHandle() {} |
19 | 19 |
| 20 QuicClientPromisedInfo* QuicClientPushPromiseIndex::GetPromised( |
| 21 const string& url) { |
| 22 QuicPromisedByUrlMap::iterator it = promised_by_url_.find(url); |
| 23 if (it == promised_by_url_.end()) { |
| 24 return nullptr; |
| 25 } |
| 26 return it->second; |
| 27 } |
| 28 |
20 QuicAsyncStatus QuicClientPushPromiseIndex::Try( | 29 QuicAsyncStatus QuicClientPushPromiseIndex::Try( |
21 const SpdyHeaderBlock& request, | 30 const SpdyHeaderBlock& request, |
22 QuicClientPushPromiseIndex::Delegate* delegate, | 31 QuicClientPushPromiseIndex::Delegate* delegate, |
23 TryHandle** handle) { | 32 TryHandle** handle) { |
24 string url(SpdyUtils::GetUrlFromHeaderBlock(request)); | 33 string url(SpdyUtils::GetUrlFromHeaderBlock(request)); |
25 QuicPromisedByUrlMap::iterator it = promised_by_url_.find(url); | 34 QuicPromisedByUrlMap::iterator it = promised_by_url_.find(url); |
26 if (it != promised_by_url_.end()) { | 35 if (it != promised_by_url_.end()) { |
27 QuicClientPromisedInfo* promised = it->second; | 36 QuicClientPromisedInfo* promised = it->second; |
28 QuicAsyncStatus rv = promised->HandleClientRequest(request, delegate); | 37 QuicAsyncStatus rv = promised->HandleClientRequest(request, delegate); |
29 if (rv == QUIC_PENDING) { | 38 if (rv == QUIC_PENDING) { |
30 *handle = promised; | 39 *handle = promised; |
31 } | 40 } |
32 return rv; | 41 return rv; |
33 } | 42 } |
34 return QUIC_FAILURE; | 43 return QUIC_FAILURE; |
35 } | 44 } |
36 | 45 |
37 } // namespace net | 46 } // namespace net |
OLD | NEW |