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

Side by Side Diff: components/gcm_driver/gcm_client_impl.cc

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add scary comment Created 5 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/gcm_driver/gcm_client_impl.h" 5 #include "components/gcm_driver/gcm_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 ConnectionFactory* connection_factory, 248 ConnectionFactory* connection_factory,
249 GCMStore* gcm_store, 249 GCMStore* gcm_store,
250 GCMStatsRecorder* recorder) { 250 GCMStatsRecorder* recorder) {
251 return scoped_ptr<MCSClient>(new MCSClient( 251 return scoped_ptr<MCSClient>(new MCSClient(
252 version, clock, connection_factory, gcm_store, recorder)); 252 version, clock, connection_factory, gcm_store, recorder));
253 } 253 }
254 254
255 scoped_ptr<ConnectionFactory> GCMInternalsBuilder::BuildConnectionFactory( 255 scoped_ptr<ConnectionFactory> GCMInternalsBuilder::BuildConnectionFactory(
256 const std::vector<GURL>& endpoints, 256 const std::vector<GURL>& endpoints,
257 const net::BackoffEntry::Policy& backoff_policy, 257 const net::BackoffEntry::Policy& backoff_policy,
258 const scoped_refptr<net::HttpNetworkSession>& gcm_network_session, 258 net::HttpNetworkSession* gcm_network_session,
259 const scoped_refptr<net::HttpNetworkSession>& http_network_session, 259 net::HttpNetworkSession* http_network_session,
260 net::NetLog* net_log, 260 net::NetLog* net_log,
261 GCMStatsRecorder* recorder) { 261 GCMStatsRecorder* recorder) {
262 return make_scoped_ptr<ConnectionFactory>( 262 return make_scoped_ptr<ConnectionFactory>(
263 new ConnectionFactoryImpl(endpoints, 263 new ConnectionFactoryImpl(endpoints,
264 backoff_policy, 264 backoff_policy,
265 gcm_network_session, 265 gcm_network_session,
266 http_network_session, 266 http_network_session,
267 net_log, 267 net_log,
268 recorder)); 268 recorder));
269 } 269 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 GCMClient::Delegate* delegate) { 319 GCMClient::Delegate* delegate) {
320 DCHECK_EQ(UNINITIALIZED, state_); 320 DCHECK_EQ(UNINITIALIZED, state_);
321 DCHECK(url_request_context_getter.get()); 321 DCHECK(url_request_context_getter.get());
322 DCHECK(delegate); 322 DCHECK(delegate);
323 323
324 url_request_context_getter_ = url_request_context_getter; 324 url_request_context_getter_ = url_request_context_getter;
325 const net::HttpNetworkSession::Params* network_session_params = 325 const net::HttpNetworkSession::Params* network_session_params =
326 url_request_context_getter_->GetURLRequestContext()-> 326 url_request_context_getter_->GetURLRequestContext()->
327 GetNetworkSessionParams(); 327 GetNetworkSessionParams();
328 DCHECK(network_session_params); 328 DCHECK(network_session_params);
329 network_session_ = new net::HttpNetworkSession(*network_session_params); 329 network_session_.reset(new net::HttpNetworkSession(*network_session_params));
330 330
331 chrome_build_info_ = chrome_build_info; 331 chrome_build_info_ = chrome_build_info;
332 332
333 gcm_store_.reset( 333 gcm_store_.reset(
334 new GCMStoreImpl(path, blocking_task_runner, encryptor.Pass())); 334 new GCMStoreImpl(path, blocking_task_runner, encryptor.Pass()));
335 335
336 delegate_ = delegate; 336 delegate_ = delegate;
337 337
338 recorder_.SetDelegate(this); 338 recorder_.SetDelegate(this);
339 339
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 StartCheckin(); 476 StartCheckin();
477 } 477 }
478 478
479 void GCMClientImpl::InitializeMCSClient() { 479 void GCMClientImpl::InitializeMCSClient() {
480 std::vector<GURL> endpoints; 480 std::vector<GURL> endpoints;
481 endpoints.push_back(gservices_settings_.GetMCSMainEndpoint()); 481 endpoints.push_back(gservices_settings_.GetMCSMainEndpoint());
482 endpoints.push_back(gservices_settings_.GetMCSFallbackEndpoint()); 482 endpoints.push_back(gservices_settings_.GetMCSFallbackEndpoint());
483 connection_factory_ = internals_builder_->BuildConnectionFactory( 483 connection_factory_ = internals_builder_->BuildConnectionFactory(
484 endpoints, 484 endpoints,
485 GetGCMBackoffPolicy(), 485 GetGCMBackoffPolicy(),
486 network_session_, 486 network_session_.get(),
487 url_request_context_getter_->GetURLRequestContext() 487 url_request_context_getter_->GetURLRequestContext()
488 ->http_transaction_factory() 488 ->http_transaction_factory()
489 ->GetSession(), 489 ->GetSession(),
490 net_log_.net_log(), 490 nullptr,
Nicolas Zea 2015/08/31 19:43:28 Did you mean to change this?
mmenke 2015/08/31 19:48:51 Yes. The current code is creating a BoundNetLog w
Nicolas Zea 2015/08/31 22:26:49 Got it. May as well just remove the net_log_ membe
mmenke 2015/09/01 17:20:52 Done.
491 &recorder_); 491 &recorder_);
492 connection_factory_->SetConnectionListener(this); 492 connection_factory_->SetConnectionListener(this);
493 mcs_client_ = internals_builder_->BuildMCSClient( 493 mcs_client_ = internals_builder_->BuildMCSClient(
494 chrome_build_info_.version, 494 chrome_build_info_.version,
495 clock_.get(), 495 clock_.get(),
496 connection_factory_.get(), 496 connection_factory_.get(),
497 gcm_store_.get(), 497 gcm_store_.get(),
498 &recorder_).Pass(); 498 &recorder_).Pass();
499 499
500 mcs_client_->Initialize( 500 mcs_client_->Initialize(
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 bool GCMClientImpl::HasStandaloneRegisteredApp() const { 1373 bool GCMClientImpl::HasStandaloneRegisteredApp() const {
1374 if (registrations_.empty()) 1374 if (registrations_.empty())
1375 return false; 1375 return false;
1376 // Note that account mapper is not counted as a standalone app since it is 1376 // Note that account mapper is not counted as a standalone app since it is
1377 // automatically started when other app uses GCM. 1377 // automatically started when other app uses GCM.
1378 return registrations_.size() > 1 || 1378 return registrations_.size() > 1 ||
1379 !ExistsGCMRegistrationInMap(registrations_, kGCMAccountMapperAppId); 1379 !ExistsGCMRegistrationInMap(registrations_, kGCMAccountMapperAppId);
1380 } 1380 }
1381 1381
1382 } // namespace gcm 1382 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698