diff options
author | dtapuska <dtapuska@chromium.org> | 2015-05-01 06:58:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-01 14:26:21 +0000 |
commit | dafcf89b36898f4f4afc010824879290b9e51e3a (patch) | |
tree | 37abdef8dfe04288c9401a0baf04be28f9118ab4 /components/history | |
parent | f75b259d8c304678fe77867b9ca01e9a9e6a202a (diff) | |
download | chromium_src-dafcf89b36898f4f4afc010824879290b9e51e3a.zip chromium_src-dafcf89b36898f4f4afc010824879290b9e51e3a.tar.gz chromium_src-dafcf89b36898f4f4afc010824879290b9e51e3a.tar.bz2 |
Adjust URLFetcher::Create API so that object is returned as scoped_ptr.
Most interfaces were storing the object in a scoped_ptr already. This
adjusts the API so that it is a little clearer of the ownership
transfer.
A number of clients put the URLFetcher in a table and do memory
management on it themselves; this is likely templatable code
for a future CL. The scope of this CL was to change the API but
no control flow changes. Making this change found one memory leak;
(http://crbug.com/482459) has been addressed separately.
BUG=371201
TESTS=net_unittests google_api_unittests
TBR=jochen@chromium.org, thakis@chromium.org, oshima@chromium.org, armansito@chromium.org, reillyg@chromium.org, rogerta@chromium.org, stuartmorgan@chromium.org, wez@chromium.org, pavely@chromium.org, rouslan@chromium.org
Review URL: https://codereview.chromium.org/1117703002
Cr-Commit-Position: refs/heads/master@{#327901}
Diffstat (limited to 'components/history')
-rw-r--r-- | components/history/core/browser/web_history_service.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/components/history/core/browser/web_history_service.cc b/components/history/core/browser/web_history_service.cc index 91b498c..4a8b3aa 100644 --- a/components/history/core/browser/web_history_service.cc +++ b/components/history/core/browser/web_history_service.cc @@ -139,7 +139,7 @@ class RequestImpl : public WebHistoryService::Request, UMA_HISTOGRAM_BOOLEAN("WebHistory.OAuthTokenCompletion", true); // Got an access token -- start the actual API request. - url_fetcher_.reset(CreateUrlFetcher(access_token)); + url_fetcher_ = CreateUrlFetcher(access_token); url_fetcher_->Start(); } @@ -156,11 +156,12 @@ class RequestImpl : public WebHistoryService::Request, } // Helper for creating a new URLFetcher for the API request. - net::URLFetcher* CreateUrlFetcher(const std::string& access_token) { + scoped_ptr<net::URLFetcher> CreateUrlFetcher( + const std::string& access_token) { net::URLFetcher::RequestType request_type = post_data_.empty() ? net::URLFetcher::GET : net::URLFetcher::POST; - net::URLFetcher* fetcher = net::URLFetcher::Create( - url_, request_type, this); + scoped_ptr<net::URLFetcher> fetcher = + net::URLFetcher::Create(url_, request_type, this); fetcher->SetRequestContext(request_context_.get()); fetcher->SetMaxRetriesOn5xx(kMaxRetries); fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |