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

Side by Side Diff: media/cast/net/udp_transport.h

Issue 2253753002: Always use NonBlocking IO for UDP sockets on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 3 years, 8 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef MEDIA_CAST_NET_UDP_TRANSPORT_H_ 5 #ifndef MEDIA_CAST_NET_UDP_TRANSPORT_H_
6 #define MEDIA_CAST_NET_UDP_TRANSPORT_H_ 6 #define MEDIA_CAST_NET_UDP_TRANSPORT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void SetDscp(net::DiffServCodePoint dscp); 60 void SetDscp(net::DiffServCodePoint dscp);
61 61
62 // Set UdpTransport options. 62 // Set UdpTransport options.
63 // Possible keys are: 63 // Possible keys are:
64 // "pacer_max_burst_size": int 64 // "pacer_max_burst_size": int
65 // - Specifies how many pakcets to send per 10 ms, maximum. 65 // - Specifies how many pakcets to send per 10 ms, maximum.
66 // "send_buffer_min_size": int 66 // "send_buffer_min_size": int
67 // - Specifies the minimum socket send buffer size. 67 // - Specifies the minimum socket send buffer size.
68 // "DSCP" (value ignored) 68 // "DSCP" (value ignored)
69 // - Turns DSCP on (higher IP Precedence and Type of Service). 69 // - Turns DSCP on (higher IP Precedence and Type of Service).
70 // "disable_non_blocking_io" (value ignored)
71 // - Windows only. Turns off non-blocking IO for the socket.
72 // Note: Non-blocking IO is, by default, enabled on all platforms.
73 void SetUdpOptions(const base::DictionaryValue& options); 70 void SetUdpOptions(const base::DictionaryValue& options);
74 71
75 // This has to be called before |StartReceiving()| to change the 72 // This has to be called before |StartReceiving()| to change the
76 // |send_buffer_size_|. Calling |SetUdpOptions()| will automatically call it. 73 // |send_buffer_size_|. Calling |SetUdpOptions()| will automatically call it.
77 void SetSendBufferSize(int32_t send_buffer_size); 74 void SetSendBufferSize(int32_t send_buffer_size);
78 75
79 #if defined(OS_WIN)
80 // Switch to use non-blocking IO. Must be called before StartReceiving().
81 void UseNonBlockingIO();
82 #endif
83
84 // PacketTransport implementations. 76 // PacketTransport implementations.
85 bool SendPacket(PacketRef packet, const base::Closure& cb) final; 77 bool SendPacket(PacketRef packet, const base::Closure& cb) final;
86 int64_t GetBytesSent() final; 78 int64_t GetBytesSent() final;
87 79
88 private: 80 private:
89 // Requests and processes packets from |udp_socket_|. This method is called 81 // Requests and processes packets from |udp_socket_|. This method is called
90 // once with |length_or_status| set to net::ERR_IO_PENDING to start receiving 82 // once with |length_or_status| set to net::ERR_IO_PENDING to start receiving
91 // packets. Thereafter, it is called with some other value as the callback 83 // packets. Thereafter, it is called with some other value as the callback
92 // response from UdpSocket::RecvFrom(). 84 // response from UdpSocket::RecvFrom().
93 void ReceiveNextPacket(int length_or_status); 85 void ReceiveNextPacket(int length_or_status);
(...skipping 25 matching lines...) Expand all
119 // NOTE: Weak pointers must be invalidated before all other member variables. 111 // NOTE: Weak pointers must be invalidated before all other member variables.
120 base::WeakPtrFactory<UdpTransport> weak_factory_; 112 base::WeakPtrFactory<UdpTransport> weak_factory_;
121 113
122 DISALLOW_COPY_AND_ASSIGN(UdpTransport); 114 DISALLOW_COPY_AND_ASSIGN(UdpTransport);
123 }; 115 };
124 116
125 } // namespace cast 117 } // namespace cast
126 } // namespace media 118 } // namespace media
127 119
128 #endif // MEDIA_CAST_NET_UDP_TRANSPORT_H_ 120 #endif // MEDIA_CAST_NET_UDP_TRANSPORT_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_udp_unittest.cc ('k') | media/cast/net/udp_transport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698