| 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_
|
|
|