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

Unified Diff: chrome/test/chromedriver/net/port_server.h

Issue 655063002: Use uint16 for port numbers more pervasively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert bad change Created 6 years, 1 month 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
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | chrome/test/chromedriver/net/port_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/net/port_server.h
diff --git a/chrome/test/chromedriver/net/port_server.h b/chrome/test/chromedriver/net/port_server.h
index 89af0c36b2175aa0da7183622595235b68ed74ec..00e56b57385fba7dc4faa4aca9b06ea5470b3338 100644
--- a/chrome/test/chromedriver/net/port_server.h
+++ b/chrome/test/chromedriver/net/port_server.h
@@ -17,14 +17,14 @@ class Status;
class PortReservation {
public:
- PortReservation(const base::Closure& on_free_func, int port);
+ PortReservation(const base::Closure& on_free_func, uint16 port);
~PortReservation();
void Leak();
private:
base::Closure on_free_func_;
- int port_;
+ uint16 port_;
};
// Communicates with a port reservation management server.
@@ -35,40 +35,40 @@ class PortServer {
explicit PortServer(const std::string& path);
~PortServer();
- Status ReservePort(int* port, scoped_ptr<PortReservation>* reservation);
+ Status ReservePort(uint16* port, scoped_ptr<PortReservation>* reservation);
private:
- Status RequestPort(int* port);
- void ReleasePort(int port);
+ Status RequestPort(uint16* port);
+ void ReleasePort(uint16 port);
std::string path_;
base::Lock free_lock_;
- std::list<int> free_;
+ std::list<uint16> free_;
};
// Manages reservation of a block of local ports.
class PortManager {
public:
- PortManager(int min_port, int max_port);
+ PortManager(uint16 min_port, uint16 max_port);
~PortManager();
- Status ReservePort(int* port, scoped_ptr<PortReservation>* reservation);
+ Status ReservePort(uint16* port, scoped_ptr<PortReservation>* reservation);
// Since we cannot remove forwarded adb ports on older SDKs,
// maintain a pool of forwarded ports for reuse.
- Status ReservePortFromPool(int* port,
+ Status ReservePortFromPool(uint16* port,
scoped_ptr<PortReservation>* reservation);
private:
- int FindAvailablePort() const;
- void ReleasePort(int port);
- void ReleasePortToPool(int port);
+ uint16 FindAvailablePort() const;
+ void ReleasePort(uint16 port);
+ void ReleasePortToPool(uint16 port);
base::Lock lock_;
- std::set<int> taken_;
- std::list<int> unused_forwarded_port_;
- int min_port_;
- int max_port_;
+ std::set<uint16> taken_;
+ std::list<uint16> unused_forwarded_port_;
+ uint16 min_port_;
+ uint16 max_port_;
};
#endif // CHROME_TEST_CHROMEDRIVER_NET_PORT_SERVER_H_
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | chrome/test/chromedriver/net/port_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698