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

Side by Side Diff: components/signin/core/browser/gaia_cookie_manager_service.cc

Issue 1108053003: Fix gaia logout URLFetcher memory leak (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « components/signin/core/browser/gaia_cookie_manager_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/signin/core/browser/gaia_cookie_manager_service.h" 5 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // be the last call in any other method. 450 // be the last call in any other method.
451 FOR_EACH_OBSERVER(Observer, observer_list_, 451 FOR_EACH_OBSERVER(Observer, observer_list_,
452 OnAddAccountToCookieCompleted(account_id, error)); 452 OnAddAccountToCookieCompleted(account_id, error));
453 } 453 }
454 454
455 void GaiaCookieManagerService::StartLogOutUrlFetch() { 455 void GaiaCookieManagerService::StartLogOutUrlFetch() {
456 DCHECK(requests_.front().request_type() == GaiaCookieRequestType::LOG_OUT); 456 DCHECK(requests_.front().request_type() == GaiaCookieRequestType::LOG_OUT);
457 VLOG(1) << "GaiaCookieManagerService::StartLogOutUrlFetch"; 457 VLOG(1) << "GaiaCookieManagerService::StartLogOutUrlFetch";
458 GURL logout_url(GaiaUrls::GetInstance()->service_logout_url().Resolve( 458 GURL logout_url(GaiaUrls::GetInstance()->service_logout_url().Resolve(
459 base::StringPrintf("?source=%s", source_.c_str()))); 459 base::StringPrintf("?source=%s", source_.c_str())));
460 net::URLFetcher* fetcher = 460 logout_url_request_.reset(
461 net::URLFetcher::Create(logout_url, net::URLFetcher::GET, this); 461 net::URLFetcher::Create(logout_url, net::URLFetcher::GET, this));
462 fetcher->SetRequestContext(signin_client_->GetURLRequestContext()); 462 logout_url_request_->SetRequestContext(
463 fetcher->Start(); 463 signin_client_->GetURLRequestContext());
464 logout_url_request_->Start();
464 } 465 }
465 466
466 void GaiaCookieManagerService::OnUbertokenSuccess( 467 void GaiaCookieManagerService::OnUbertokenSuccess(
467 const std::string& uber_token) { 468 const std::string& uber_token) {
468 DCHECK(requests_.front().request_type() == 469 DCHECK(requests_.front().request_type() ==
469 GaiaCookieRequestType::ADD_ACCOUNT); 470 GaiaCookieRequestType::ADD_ACCOUNT);
470 VLOG(1) << "GaiaCookieManagerService::OnUbertokenSuccess" 471 VLOG(1) << "GaiaCookieManagerService::OnUbertokenSuccess"
471 << " account=" << requests_.front().account_id(); 472 << " account=" << requests_.front().account_id();
472 fetcher_retries_ = 0; 473 fetcher_retries_ = 0;
473 uber_token_ = uber_token; 474 uber_token_ = uber_token;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 gaia_auth_fetcher_.reset( 590 gaia_auth_fetcher_.reset(
590 new GaiaAuthFetcher(this, source_, 591 new GaiaAuthFetcher(this, source_,
591 signin_client_->GetURLRequestContext())); 592 signin_client_->GetURLRequestContext()));
592 gaia_auth_fetcher_->StartListAccounts(); 593 gaia_auth_fetcher_->StartListAccounts();
593 } 594 }
594 595
595 void GaiaCookieManagerService::OnURLFetchComplete( 596 void GaiaCookieManagerService::OnURLFetchComplete(
596 const net::URLFetcher* source) { 597 const net::URLFetcher* source) {
597 DCHECK(requests_.front().request_type() == GaiaCookieRequestType::LOG_OUT); 598 DCHECK(requests_.front().request_type() == GaiaCookieRequestType::LOG_OUT);
598 VLOG(1) << "GaiaCookieManagerService::OnURLFetchComplete"; 599 VLOG(1) << "GaiaCookieManagerService::OnURLFetchComplete";
600 scoped_ptr<net::URLFetcher> logout_url_request(logout_url_request_.Pass());
599 601
600 if ((!source->GetStatus().is_success() || 602 if ((!source->GetStatus().is_success() ||
601 source->GetResponseCode() != net::HTTP_OK) && 603 source->GetResponseCode() != net::HTTP_OK) &&
602 ++fetcher_retries_ < kMaxFetcherRetries) { 604 ++fetcher_retries_ < kMaxFetcherRetries) {
603 fetcher_backoff_.InformOfRequest(false); 605 fetcher_backoff_.InformOfRequest(false);
604 fetcher_timer_.Start( 606 fetcher_timer_.Start(
605 FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), this, 607 FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), this,
606 &GaiaCookieManagerService::StartLogOutUrlFetch); 608 &GaiaCookieManagerService::StartLogOutUrlFetch);
607 return; 609 return;
608 } 610 }
(...skipping 29 matching lines...) Expand all
638 case GaiaCookieRequestType::LOG_OUT: 640 case GaiaCookieRequestType::LOG_OUT:
639 StartLogOutUrlFetch(); 641 StartLogOutUrlFetch();
640 break; 642 break;
641 case GaiaCookieRequestType::LIST_ACCOUNTS: 643 case GaiaCookieRequestType::LIST_ACCOUNTS:
642 uber_token_fetcher_.reset(); 644 uber_token_fetcher_.reset();
643 StartFetchingListAccounts(); 645 StartFetchingListAccounts();
644 break; 646 break;
645 }; 647 };
646 } 648 }
647 } 649 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/gaia_cookie_manager_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698