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

Side by Side Diff: net/tools/flip_server/output_ordering.h

Issue 2169503002: Remove flip_server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « net/tools/flip_server/mem_cache_test.cc ('k') | net/tools/flip_server/output_ordering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #ifndef NET_TOOLS_FLIP_SERVER_OUTPUT_ORDERING_H_
6 #define NET_TOOLS_FLIP_SERVER_OUTPUT_ORDERING_H_
7
8 #include <stdint.h>
9
10 #include <list>
11 #include <map>
12 #include <string>
13
14 #include "base/compiler_specific.h"
15 #include "net/tools/epoll_server/epoll_server.h"
16 #include "net/tools/flip_server/constants.h"
17 #include "net/tools/flip_server/mem_cache.h"
18
19 namespace net {
20
21 class SMConnectionInterface;
22
23 class OutputOrdering {
24 public:
25 typedef std::list<MemCacheIter> PriorityRing;
26 typedef std::map<uint32_t, PriorityRing> PriorityMap;
27
28 struct PriorityMapPointer {
29 PriorityMapPointer();
30 PriorityMapPointer(const PriorityMapPointer& other);
31 ~PriorityMapPointer();
32 PriorityRing* ring;
33 PriorityRing::iterator it;
34 bool alarm_enabled;
35 EpollServer::AlarmRegToken alarm_token;
36 };
37
38 typedef std::map<uint32_t, PriorityMapPointer> StreamIdToPriorityMap;
39
40 StreamIdToPriorityMap stream_ids_;
41 PriorityMap priority_map_;
42 PriorityRing first_data_senders_;
43 uint32_t first_data_senders_threshold_; // when you've passed this, you're no
44 // longer a first_data_sender...
45 SMConnectionInterface* connection_;
46 EpollServer* epoll_server_;
47
48 explicit OutputOrdering(SMConnectionInterface* connection);
49 ~OutputOrdering();
50 void Reset();
51 bool ExistsInPriorityMaps(uint32_t stream_id) const;
52
53 struct BeginOutputtingAlarm : public EpollAlarmCallbackInterface {
54 public:
55 BeginOutputtingAlarm(OutputOrdering* oo,
56 OutputOrdering::PriorityMapPointer* pmp,
57 const MemCacheIter& mci);
58 ~BeginOutputtingAlarm() override;
59
60 // EpollAlarmCallbackInterface:
61 int64_t OnAlarm() override;
62 void OnRegistration(const EpollServer::AlarmRegToken& tok,
63 EpollServer* eps) override;
64 void OnUnregistration() override;
65 void OnShutdown(EpollServer* eps) override;
66
67 private:
68 OutputOrdering* output_ordering_;
69 OutputOrdering::PriorityMapPointer* pmp_;
70 MemCacheIter mci_;
71 EpollServer* epoll_server_;
72 };
73
74 void MoveToActive(PriorityMapPointer* pmp, MemCacheIter mci);
75 void AddToOutputOrder(const MemCacheIter& mci);
76 void SpliceToPriorityRing(PriorityRing::iterator pri);
77 MemCacheIter* GetIter();
78 void RemoveStreamId(uint32_t stream_id);
79
80 static double server_think_time_in_s() { return server_think_time_in_s_; }
81 static void set_server_think_time_in_s(double value) {
82 server_think_time_in_s_ = value;
83 }
84
85 private:
86 static double server_think_time_in_s_;
87 };
88
89 } // namespace net
90
91 #endif // NET_TOOLS_FLIP_SERVER_OUTPUT_ORDERING_H_
OLDNEW
« no previous file with comments | « net/tools/flip_server/mem_cache_test.cc ('k') | net/tools/flip_server/output_ordering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698