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

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

Issue 127143003: [chromedriver] Reuse forwarded adb ports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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: 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 3d32950373f5b1081826c4895857e0062f96a64e..daa01e9c588a9e0d36ff6efb7e8f2f1482cc19cb 100644
--- a/chrome/test/chromedriver/net/port_server.h
+++ b/chrome/test/chromedriver/net/port_server.h
@@ -50,7 +50,9 @@ class PortServer {
// Manages reservation of a block of local ports.
class PortManager {
public:
- PortManager(int min_port, int max_port);
+ // Since we cannot remove forwarded adb ports on older SDKs,
+ // maintain a pool of forwarded ports for reuse when |reuse| is true
+ PortManager(int min_port, int max_port, bool reuse);
~PortManager();
Status ReservePort(int* port, scoped_ptr<PortReservation>* reservation);
@@ -58,11 +60,12 @@ class PortManager {
private:
void ReleasePort(int port);
- base::Lock taken_lock_;
+ base::Lock lock_;
std::set<int> taken_;
-
+ std::list<int> unused_forwarded_port_;
int min_port_;
int max_port_;
+ bool reuse_;
};
#endif // CHROME_TEST_CHROMEDRIVER_NET_PORT_SERVER_H_

Powered by Google App Engine
This is Rietveld 408576698