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

Unified Diff: remoting/protocol/transport_context.h

Issue 1571943002: Simplify PortAllocatorBase and make PortAllocator creation synchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « remoting/protocol/port_allocator_factory.h ('k') | remoting/protocol/transport_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/transport_context.h
diff --git a/remoting/protocol/transport_context.h b/remoting/protocol/transport_context.h
index 12a6c3dfde90045243cb21daef982f3d300eed2b..fbe0b37f140c490878ee91e406d5f5eb253b8667 100644
--- a/remoting/protocol/transport_context.h
+++ b/remoting/protocol/transport_context.h
@@ -30,32 +30,33 @@ class PortAllocatorFactory;
// TransportContext is responsible for storing all parameters required for
// P2P transport initialization. It's also responsible for making JingleInfo
-// request and creation of PortAllocators configured according to the JingleInfo
-// result.
+// request.
class TransportContext : public base::RefCountedThreadSafe<TransportContext> {
public:
- typedef base::Callback<void(scoped_ptr<cricket::PortAllocator>
- port_allocator)> CreatePortAllocatorCallback;
+ typedef base::Callback<void(std::vector<rtc::SocketAddress> stun_hosts,
+ std::vector<std::string> relay_hosts,
+ std::string relay_token)> GetJingleInfoCallback;
static scoped_refptr<TransportContext> ForTests(TransportRole role);
- TransportContext(
- SignalStrategy* signal_strategy,
- scoped_ptr<PortAllocatorFactory> port_allocator_factory,
- const NetworkSettings& network_settings,
- TransportRole role);
+ TransportContext(SignalStrategy* signal_strategy,
+ scoped_ptr<PortAllocatorFactory> port_allocator_factory,
+ const NetworkSettings& network_settings,
+ TransportRole role);
- // Prepares to create new PortAllocator instances. It may be called while
- // connection is being negotiated to minimize the chance that the following
- // CreatePortAllocator() will be blocking.
+ // Prepares fresh JingleInfo. It may be called while connection is being
+ // negotiated to minimize the chance that the following GetJingleInfo() will
+ // be blocking.
void Prepare();
- // Creates new PortAllocator making sure that it has correct STUN and TURN
- // information.
- void CreatePortAllocator(const CreatePortAllocatorCallback& callback);
+ // Requests fresh STUN and TURN information.
+ void GetJingleInfo(const GetJingleInfoCallback& callback);
- const NetworkSettings& network_settings() { return network_settings_; }
- TransportRole role() { return role_; }
+ PortAllocatorFactory* port_allocator_factory() {
+ return port_allocator_factory_.get();
+ }
+ const NetworkSettings& network_settings() const { return network_settings_; }
+ TransportRole role() const { return role_; }
private:
friend class base::RefCountedThreadSafe<TransportContext>;
@@ -67,8 +68,6 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> {
const std::vector<std::string>& relay_hosts,
const std::vector<rtc::SocketAddress>& stun_hosts);
- scoped_ptr<cricket::PortAllocator> CreatePortAllocatorInternal();
-
SignalStrategy* signal_strategy_;
scoped_ptr<PortAllocatorFactory> port_allocator_factory_;
NetworkSettings network_settings_;
@@ -77,13 +76,13 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> {
base::TimeTicks last_jingle_info_update_time_;
scoped_ptr<JingleInfoRequest> jingle_info_request_;
- std::string relay_token_;
- std::vector<std::string> relay_hosts_;
std::vector<rtc::SocketAddress> stun_hosts_;
+ std::vector<std::string> relay_hosts_;
+ std::string relay_token_;
// When there is an active |jingle_info_request_| stores list of callbacks to
- // be called once the |jingle_info_request_| is finished.
- std::list<CreatePortAllocatorCallback> pending_port_allocator_requests_;
+ // be called once the request is finished.
+ std::list<GetJingleInfoCallback> pending_jingle_info_callbacks_;
DISALLOW_COPY_AND_ASSIGN(TransportContext);
};
« no previous file with comments | « remoting/protocol/port_allocator_factory.h ('k') | remoting/protocol/transport_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698