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

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: Addressed nits 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..89af0c36b2175aa0da7183622595235b68ed74ec 100644
--- a/chrome/test/chromedriver/net/port_server.h
+++ b/chrome/test/chromedriver/net/port_server.h
@@ -54,13 +54,19 @@ class PortManager {
~PortManager();
Status ReservePort(int* 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,
+ scoped_ptr<PortReservation>* reservation);
private:
+ int FindAvailablePort() const;
void ReleasePort(int port);
+ void ReleasePortToPool(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_;
};

Powered by Google App Engine
This is Rietveld 408576698