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

Side by Side Diff: google_apis/gcm/engine/connection_factory_impl.h

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_
6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_
7 7
8 #include "google_apis/gcm/engine/connection_factory.h" 8 #include "google_apis/gcm/engine/connection_factory.h"
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 18 matching lines...) Expand all
29 class GCMStatsRecorder; 29 class GCMStatsRecorder;
30 30
31 class GCM_EXPORT ConnectionFactoryImpl : 31 class GCM_EXPORT ConnectionFactoryImpl :
32 public ConnectionFactory, 32 public ConnectionFactory,
33 public net::NetworkChangeNotifier::NetworkChangeObserver { 33 public net::NetworkChangeNotifier::NetworkChangeObserver {
34 public: 34 public:
35 // |http_network_session| is an optional network session to use as a source 35 // |http_network_session| is an optional network session to use as a source
36 // for proxy auth credentials (via its HttpAuthCache). |gcm_network_session| 36 // for proxy auth credentials (via its HttpAuthCache). |gcm_network_session|
37 // is the network session through which GCM connections should be made, and 37 // is the network session through which GCM connections should be made, and
38 // must not be the same as |http_network_session|. 38 // must not be the same as |http_network_session|.
39 //
40 // The caller is responsible for making sure the ConnectionFactoryImpl is
41 // destroyed before the |gcm_network_session| and |http_network_session|.
39 ConnectionFactoryImpl( 42 ConnectionFactoryImpl(
40 const std::vector<GURL>& mcs_endpoints, 43 const std::vector<GURL>& mcs_endpoints,
41 const net::BackoffEntry::Policy& backoff_policy, 44 const net::BackoffEntry::Policy& backoff_policy,
42 const scoped_refptr<net::HttpNetworkSession>& gcm_network_session, 45 net::HttpNetworkSession* gcm_network_session,
43 const scoped_refptr<net::HttpNetworkSession>& http_network_session, 46 net::HttpNetworkSession* http_network_session,
44 net::NetLog* net_log, 47 net::NetLog* net_log,
45 GCMStatsRecorder* recorder); 48 GCMStatsRecorder* recorder);
46 ~ConnectionFactoryImpl() override; 49 ~ConnectionFactoryImpl() override;
47 50
48 // ConnectionFactory implementation. 51 // ConnectionFactory implementation.
49 void Initialize( 52 void Initialize(
50 const BuildLoginRequestCallback& request_builder, 53 const BuildLoginRequestCallback& request_builder,
51 const ConnectionHandler::ProtoReceivedCallback& read_callback, 54 const ConnectionHandler::ProtoReceivedCallback& read_callback,
52 const ConnectionHandler::ProtoSentCallback& write_callback) override; 55 const ConnectionHandler::ProtoSentCallback& write_callback) override;
53 ConnectionHandler* GetConnectionHandler() const override; 56 ConnectionHandler* GetConnectionHandler() const override;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Index to the endpoint for which a connection should be attempted next. 131 // Index to the endpoint for which a connection should be attempted next.
129 size_t next_endpoint_; 132 size_t next_endpoint_;
130 // Index to the endpoint that was last successfully connected. 133 // Index to the endpoint that was last successfully connected.
131 size_t last_successful_endpoint_; 134 size_t last_successful_endpoint_;
132 135
133 // The backoff policy to use. 136 // The backoff policy to use.
134 const net::BackoffEntry::Policy backoff_policy_; 137 const net::BackoffEntry::Policy backoff_policy_;
135 138
136 // ---- net:: components for establishing connections. ---- 139 // ---- net:: components for establishing connections. ----
137 // Network session for creating new GCM connections. 140 // Network session for creating new GCM connections.
138 const scoped_refptr<net::HttpNetworkSession> gcm_network_session_; 141 net::HttpNetworkSession* gcm_network_session_;
139 // HTTP Network session. If set, is used for extracting proxy auth 142 // HTTP Network session. If set, is used for extracting proxy auth
140 // credentials. If not set, is ignored. 143 // credentials. If nullptr, is ignored.
141 const scoped_refptr<net::HttpNetworkSession> http_network_session_; 144 net::HttpNetworkSession* http_network_session_;
142 // Net log to use in connection attempts. 145 // Net log to use in connection attempts.
143 net::BoundNetLog bound_net_log_; 146 net::BoundNetLog bound_net_log_;
144 // The current PAC request, if one exists. Owned by the proxy service. 147 // The current PAC request, if one exists. Owned by the proxy service.
145 net::ProxyService::PacRequest* pac_request_; 148 net::ProxyService::PacRequest* pac_request_;
146 // The current proxy info. 149 // The current proxy info.
147 net::ProxyInfo proxy_info_; 150 net::ProxyInfo proxy_info_;
148 // The handle to the socket for the current connection, if one exists. 151 // The handle to the socket for the current connection, if one exists.
149 net::ClientSocketHandle socket_handle_; 152 net::ClientSocketHandle socket_handle_;
150 // Current backoff entry. 153 // Current backoff entry.
151 scoped_ptr<net::BackoffEntry> backoff_entry_; 154 scoped_ptr<net::BackoffEntry> backoff_entry_;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ConnectionListener* listener_; 196 ConnectionListener* listener_;
194 197
195 base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_; 198 base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_;
196 199
197 DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl); 200 DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl);
198 }; 201 };
199 202
200 } // namespace gcm 203 } // namespace gcm
201 204
202 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ 205 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_
OLDNEW
« no previous file with comments | « content/shell/browser/shell_url_request_context_getter.cc ('k') | google_apis/gcm/engine/connection_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698