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

Unified Diff: extensions/browser/api/socket/udp_socket.h

Issue 2378763003: Add ability to reuse address in chrome.sockets.udp
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/socket/udp_socket.h
diff --git a/extensions/browser/api/socket/udp_socket.h b/extensions/browser/api/socket/udp_socket.h
index 17a4117441c8eb98b11531b5a85a59f1a550ebc0..27c7a59f7548f9f2eacc9f9062b622c1963bc063 100644
--- a/extensions/browser/api/socket/udp_socket.h
+++ b/extensions/browser/api/socket/udp_socket.h
@@ -39,6 +39,8 @@ class UDPSocket : public Socket {
bool IsBound();
+ virtual bool IsReusable();
+
int JoinGroup(const std::string& address);
int LeaveGroup(const std::string& address);
@@ -85,6 +87,8 @@ class ResumableUDPSocket : public UDPSocket {
// Overriden from ApiResource
bool IsPersistent() const override;
+ bool IsReusable() override;
+
const std::string& name() const { return name_; }
void set_name(const std::string& name) { name_ = name; }
@@ -97,6 +101,9 @@ class ResumableUDPSocket : public UDPSocket {
bool paused() const { return paused_; }
void set_paused(bool paused) { paused_ = paused; }
+ bool allow_address_reuse() const { return allow_address_reuse_; }
+ void set_allow_address_reuse(bool allow) { allow_address_reuse_ = allow; }
+
private:
friend class ApiResourceManager<ResumableUDPSocket>;
static const char* service_name() { return "ResumableUDPSocketManager"; }
@@ -111,6 +118,9 @@ class ResumableUDPSocket : public UDPSocket {
// Flag indicating whether a connected socket blocks its peer from sending
// more data - see sockets_udp.idl.
bool paused_;
+ // Flag indicating whether the address can be bound by multiple sockets - see
+ // sockets_udp.idl
+ bool allow_address_reuse_;
Reilly Grant (use Gerrit) 2016/09/29 06:55:55 Instead of adding this field to ResumableUDPSocket
srsudar 2016/09/29 19:32:58 Done.
};
} // namespace extensions
« no previous file with comments | « no previous file | extensions/browser/api/socket/udp_socket.cc » ('j') | extensions/test/data/sockets_udp/api/background.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698