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

Side by Side Diff: webrtc/p2p/base/transportchannel.h

Issue 1345913004: Replace readable with receiving where receiving means receiving anything (stun ping, response or da… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comments Created 5 years, 3 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 | « webrtc/p2p/base/transport.cc ('k') | webrtc/p2p/base/transportchannel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 28 matching lines...) Expand all
39 // Used to indicate channel's connection state. 39 // Used to indicate channel's connection state.
40 enum TransportChannelState { STATE_CONNECTING, STATE_COMPLETED, STATE_FAILED }; 40 enum TransportChannelState { STATE_CONNECTING, STATE_COMPLETED, STATE_FAILED };
41 41
42 // A TransportChannel represents one logical stream of packets that are sent 42 // A TransportChannel represents one logical stream of packets that are sent
43 // between the two sides of a session. 43 // between the two sides of a session.
44 class TransportChannel : public sigslot::has_slots<> { 44 class TransportChannel : public sigslot::has_slots<> {
45 public: 45 public:
46 explicit TransportChannel(const std::string& content_name, int component) 46 explicit TransportChannel(const std::string& content_name, int component)
47 : content_name_(content_name), 47 : content_name_(content_name),
48 component_(component), 48 component_(component),
49 readable_(false), writable_(false), receiving_(false) {} 49 writable_(false),
50 receiving_(false) {}
50 virtual ~TransportChannel() {} 51 virtual ~TransportChannel() {}
51 52
52 // TODO(guoweis) - Make this pure virtual once all subclasses of 53 // TODO(guoweis) - Make this pure virtual once all subclasses of
53 // TransportChannel have this defined. 54 // TransportChannel have this defined.
54 virtual TransportChannelState GetState() const { 55 virtual TransportChannelState GetState() const {
55 return TransportChannelState::STATE_CONNECTING; 56 return TransportChannelState::STATE_CONNECTING;
56 } 57 }
57 58
58 // TODO(mallinath) - Remove this API, as it's no longer useful. 59 // TODO(mallinath) - Remove this API, as it's no longer useful.
59 // Returns the session id of this channel. 60 // Returns the session id of this channel.
60 virtual const std::string SessionId() const { return std::string(); } 61 virtual const std::string SessionId() const { return std::string(); }
61 62
62 const std::string& content_name() const { return content_name_; } 63 const std::string& content_name() const { return content_name_; }
63 int component() const { return component_; } 64 int component() const { return component_; }
64 65
65 // Returns the readable and states of this channel. Each time one of these 66 // Returns the states of this channel. Each time one of these states changes,
66 // states changes, a signal is raised. These states are aggregated by the 67 // a signal is raised. These states are aggregated by the TransportManager.
67 // TransportManager.
68 bool readable() const { return readable_; }
69 bool writable() const { return writable_; } 68 bool writable() const { return writable_; }
70 bool receiving() const { return receiving_; } 69 bool receiving() const { return receiving_; }
71 sigslot::signal1<TransportChannel*> SignalReadableState;
72 sigslot::signal1<TransportChannel*> SignalWritableState; 70 sigslot::signal1<TransportChannel*> SignalWritableState;
73 // Emitted when the TransportChannel's ability to send has changed. 71 // Emitted when the TransportChannel's ability to send has changed.
74 sigslot::signal1<TransportChannel*> SignalReadyToSend; 72 sigslot::signal1<TransportChannel*> SignalReadyToSend;
75 sigslot::signal1<TransportChannel*> SignalReceivingState; 73 sigslot::signal1<TransportChannel*> SignalReceivingState;
76 74
77 // Attempts to send the given packet. The return value is < 0 on failure. 75 // Attempts to send the given packet. The return value is < 0 on failure.
78 // TODO: Remove the default argument once channel code is updated. 76 // TODO: Remove the default argument once channel code is updated.
79 virtual int SendPacket(const char* data, size_t len, 77 virtual int SendPacket(const char* data, size_t len,
80 const rtc::PacketOptions& options, 78 const rtc::PacketOptions& options,
81 int flags = 0) = 0; 79 int flags = 0) = 0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // indicates where and how we are currently sending media. 130 // indicates where and how we are currently sending media.
133 sigslot::signal2<TransportChannel*, const Candidate&> SignalRouteChange; 131 sigslot::signal2<TransportChannel*, const Candidate&> SignalRouteChange;
134 132
135 // Invoked when the channel is being destroyed. 133 // Invoked when the channel is being destroyed.
136 sigslot::signal1<TransportChannel*> SignalDestroyed; 134 sigslot::signal1<TransportChannel*> SignalDestroyed;
137 135
138 // Debugging description of this transport channel. 136 // Debugging description of this transport channel.
139 std::string ToString() const; 137 std::string ToString() const;
140 138
141 protected: 139 protected:
142 // Sets the readable state, signaling if necessary. 140 // TODO(honghaiz): Remove this once chromium's unit tests no longer call it.
143 void set_readable(bool readable); 141 void set_readable(bool readable) { set_receiving(readable); }
144 142
145 // Sets the writable state, signaling if necessary. 143 // Sets the writable state, signaling if necessary.
146 void set_writable(bool writable); 144 void set_writable(bool writable);
147 145
148 // Sets the receiving state, signaling if necessary. 146 // Sets the receiving state, signaling if necessary.
149 void set_receiving(bool receiving); 147 void set_receiving(bool receiving);
150 148
151 149
152 private: 150 private:
153 // Used mostly for debugging. 151 // Used mostly for debugging.
154 std::string content_name_; 152 std::string content_name_;
155 int component_; 153 int component_;
156 bool readable_;
157 bool writable_; 154 bool writable_;
158 bool receiving_; 155 bool receiving_;
159 156
160 RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannel); 157 RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannel);
161 }; 158 };
162 159
163 } // namespace cricket 160 } // namespace cricket
164 161
165 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ 162 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transport.cc ('k') | webrtc/p2p/base/transportchannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698