Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / net / quic / quic_stream_factory.h
index 1e22cdb..b7936c3 100644 (file)
@@ -36,7 +36,7 @@ class QuicConnectionHelper;
 class QuicCryptoClientStreamFactory;
 class QuicRandom;
 class QuicServerInfoFactory;
-class QuicSessionKey;
+class QuicServerId;
 class QuicStreamFactory;
 
 namespace test {
@@ -97,7 +97,8 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
       size_t max_packet_length,
       const QuicVersionVector& supported_versions,
       bool enable_port_selection,
-      bool enable_pacing);
+      bool enable_pacing,
+      bool enable_time_based_loss_detection);
   virtual ~QuicStreamFactory();
 
   // Creates a new QuicHttpStream to |host_port_pair| which will be
@@ -132,6 +133,9 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
 
   base::Value* QuicStreamFactoryInfoToValue() const;
 
+  // Delete all cached state objects in |crypto_config_|.
+  void ClearCachedStatesInCryptoConfig();
+
   // NetworkChangeNotifier::IPAddressObserver methods:
 
   // Until the servers support roaming, close all connections when the local
@@ -181,42 +185,44 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
     bool operator==(const IpAliasKey &other) const;
   };
 
-  typedef std::map<QuicSessionKey, QuicClientSession*> SessionMap;
-  typedef std::set<QuicSessionKey> AliasSet;
+  typedef std::map<QuicServerId, QuicClientSession*> SessionMap;
+  typedef std::map<QuicClientSession*, QuicServerId> SessionIdMap;
+  typedef std::set<QuicServerId> AliasSet;
   typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap;
   typedef std::set<QuicClientSession*> SessionSet;
   typedef std::map<IpAliasKey, SessionSet> IPAliasMap;
-  typedef std::map<QuicSessionKey, QuicCryptoClientConfig*> CryptoConfigMap;
-  typedef std::map<QuicSessionKey, Job*> JobMap;
+  typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap;
+  typedef std::map<QuicServerId, Job*> JobMap;
   typedef std::map<QuicStreamRequest*, Job*> RequestMap;
   typedef std::set<QuicStreamRequest*> RequestSet;
   typedef std::map<Job*, RequestSet> JobRequestsMap;
 
   // Returns a newly created QuicHttpStream owned by the caller, if a
   // matching session already exists.  Returns NULL otherwise.
-  scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicSessionKey& key,
+  scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicServerId& key,
                                                    const BoundNetLog& net_log);
 
-  bool OnResolution(const QuicSessionKey& session_key,
+  bool OnResolution(const QuicServerId& server_id,
                     const AddressList& address_list);
   void OnJobComplete(Job* job, int rv);
-  bool HasActiveSession(const QuicSessionKey& session_key) const;
-  bool HasActiveJob(const QuicSessionKey& session_key) const;
-  int CreateSession(const QuicSessionKey& session_key,
+  bool HasActiveSession(const QuicServerId& server_id) const;
+  bool HasActiveJob(const QuicServerId& server_id) const;
+  int CreateSession(const QuicServerId& server_id,
                     scoped_ptr<QuicServerInfo> quic_server_info,
                     const AddressList& address_list,
                     const BoundNetLog& net_log,
                     QuicClientSession** session);
-  void ActivateSession(const QuicSessionKey& key,
+  void ActivateSession(const QuicServerId& key,
                        QuicClientSession* session);
 
-  // Initializes the cached state associated with |session_key| in
+  // Initializes the cached state associated with |server_id| in
   // |crypto_config_| with the information in |server_info|.
-  void InitializeCachedState(const QuicSessionKey& session_key,
-                             const scoped_ptr<QuicServerInfo>& server_info);
+  void InitializeCachedStateInCryptoConfig(
+      const QuicServerId& server_id,
+      const scoped_ptr<QuicServerInfo>& server_info);
 
-  void ExpireBrokenAlternateProtocolMappings();
-  void ScheduleBrokenAlternateProtocolMappingsExpiration();
+  void ProcessGoingAwaySession(QuicClientSession* session,
+                               const QuicServerId& server_id);
 
   bool require_confirmation_;
   HostResolver* host_resolver_;
@@ -233,7 +239,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
   scoped_ptr<QuicConnectionHelper> helper_;
 
   // Contains owning pointers to all sessions that currently exist.
-  SessionSet all_sessions_;
+  SessionIdMap all_sessions_;
   // Contains non-owning pointers to currently active session
   // (not going away session, once they're implemented).
   SessionMap active_sessions_;
@@ -245,20 +251,6 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
   // Origins which have gone away recently.
   AliasSet gone_away_aliases_;
 
-  // List of broken host:ports and the times when they can be expired.
-  struct BrokenAlternateProtocolEntry {
-    HostPortPair origin;
-    base::TimeTicks when;
-  };
-  typedef std::list<BrokenAlternateProtocolEntry>
-      BrokenAlternateProtocolList;
-  BrokenAlternateProtocolList broken_alternate_protocol_list_;
-
-  // Map from host:port to the number of times alternate protocol has
-  // been marked broken.
-  typedef std::map<HostPortPair, int> BrokenAlternateProtocolMap;
-  BrokenAlternateProtocolMap broken_alternate_protocol_map_;
-
   QuicConfig config_;
   QuicCryptoClientConfig crypto_config_;