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