Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: net/quic/quic_multipath_received_packet_manager.cc

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015 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_multipath_received_packet_manager.h"
6
7 #include "base/stl_util.h"
8
9 #include "net/quic/quic_bug_tracker.h"
10
11 namespace net {
12
13 QuicMultipathReceivedPacketManager::QuicMultipathReceivedPacketManager(
14 QuicConnectionStats* stats) {
15 path_managers_[kDefaultPathId] = new QuicReceivedPacketManager(stats);
16 }
17
18 QuicMultipathReceivedPacketManager::~QuicMultipathReceivedPacketManager() {
19 STLDeleteValues(&path_managers_);
20 }
21
22 void QuicMultipathReceivedPacketManager::OnPathCreated(
23 QuicPathId path_id,
24 QuicConnectionStats* stats) {
25 if (path_managers_[path_id] != nullptr) {
26 QUIC_BUG << "Received packet manager of path already exists: "
27 << static_cast<uint32_t>(path_id);
28 return;
29 }
30
31 path_managers_[path_id] = new QuicReceivedPacketManager(stats);
32 }
33
34 void QuicMultipathReceivedPacketManager::OnPathClosed(QuicPathId path_id) {
35 QuicReceivedPacketManager* manager = path_managers_[path_id];
36 if (manager == nullptr) {
37 QUIC_BUG << "Received packet manager of path does not exist: "
38 << static_cast<uint32_t>(path_id);
39 return;
40 }
41
42 delete manager;
43 path_managers_.erase(path_id);
44 }
45
46 void QuicMultipathReceivedPacketManager::RecordPacketReceived(
47 QuicPathId path_id,
48 QuicByteCount bytes,
49 const QuicPacketHeader& header,
50 QuicTime receipt_time) {
51 QuicReceivedPacketManager* manager = path_managers_[path_id];
52 if (manager == nullptr) {
53 QUIC_BUG << "Received a packet on a non-existent path.";
54 return;
55 }
56
57 manager->RecordPacketReceived(bytes, header, receipt_time);
58 }
59
60 bool QuicMultipathReceivedPacketManager::IsMissing(
61 QuicPathId path_id,
62 QuicPacketNumber packet_number) {
63 QuicReceivedPacketManager* manager = path_managers_[path_id];
64 if (manager == nullptr) {
65 QUIC_BUG << "Check whether a packet is missing on a non-existent path.";
66 return true;
67 }
68
69 return manager->IsMissing(packet_number);
70 }
71
72 bool QuicMultipathReceivedPacketManager::IsAwaitingPacket(
73 QuicPathId path_id,
74 QuicPacketNumber packet_number) {
75 QuicReceivedPacketManager* manager = path_managers_[path_id];
76 if (manager == nullptr) {
77 QUIC_BUG << "Check whether a packet is awaited on a non-existent path.";
78 return false;
79 }
80
81 return manager->IsAwaitingPacket(packet_number);
82 }
83
84 void QuicMultipathReceivedPacketManager::UpdatePacketInformationSentByPeer(
85 const std::vector<QuicStopWaitingFrame>& stop_waitings) {
86 for (QuicStopWaitingFrame stop_waiting : stop_waitings) {
87 QuicReceivedPacketManager* manager = path_managers_[stop_waiting.path_id];
88 if (manager != nullptr) {
89 manager->UpdatePacketInformationSentByPeer(stop_waiting);
90 }
91 }
92 }
93
94 bool QuicMultipathReceivedPacketManager::HasNewMissingPackets(
95 QuicPathId path_id) const {
96 MultipathReceivedPacketManagerMap::const_iterator it =
97 path_managers_.find(path_id);
98 if (it == path_managers_.end()) {
99 QUIC_BUG << "Check whether has new missing packets on a non-existent path.";
100 return false;
101 }
102
103 return it->second->HasNewMissingPackets();
104 }
105
106 QuicPacketNumber
107 QuicMultipathReceivedPacketManager::GetPeerLeastPacketAwaitingAck(
108 QuicPathId path_id) {
109 QuicReceivedPacketManager* manager = path_managers_[path_id];
110 if (manager == nullptr) {
111 QUIC_BUG
112 << "Try to get peer_least_packet_awaiting_ack of a non-existent path.";
113 return false;
114 }
115
116 return manager->peer_least_packet_awaiting_ack();
117 }
118
119 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_multipath_received_packet_manager.h ('k') | net/quic/quic_multipath_received_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698