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

Side by Side Diff: chrome/browser/safe_browsing/client_side_model_loader.cc

Issue 1440593004: Make operators on scoped_ptr match the ones defined for std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrequals: followupfix-after-rebase Created 5 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/safe_browsing/client_side_model_loader.h" 5 #include "chrome/browser/safe_browsing/client_side_model_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // TODO(nparker): If no profile needs this model, we shouldn't fetch it. 112 // TODO(nparker): If no profile needs this model, we shouldn't fetch it.
113 // Then only re-fetch when a profile setting changes to need it. 113 // Then only re-fetch when a profile setting changes to need it.
114 // This will save on the order of ~50KB/week/client of bandwidth. 114 // This will save on the order of ~50KB/week/client of bandwidth.
115 fetcher_ = net::URLFetcher::Create(0 /* ID used for testing */, url_, 115 fetcher_ = net::URLFetcher::Create(0 /* ID used for testing */, url_,
116 net::URLFetcher::GET, this); 116 net::URLFetcher::GET, this);
117 fetcher_->SetRequestContext(request_context_getter_); 117 fetcher_->SetRequestContext(request_context_getter_);
118 fetcher_->Start(); 118 fetcher_->Start();
119 } 119 }
120 120
121 void ModelLoader::OnURLFetchComplete(const net::URLFetcher* source) { 121 void ModelLoader::OnURLFetchComplete(const net::URLFetcher* source) {
122 DCHECK_EQ(fetcher_, source); 122 DCHECK_EQ(fetcher_.get(), source);
123 DCHECK_EQ(url_, source->GetURL()); 123 DCHECK_EQ(url_, source->GetURL());
124 124
125 std::string data; 125 std::string data;
126 source->GetResponseAsString(&data); 126 source->GetResponseAsString(&data);
127 net::URLRequestStatus status = source->GetStatus(); 127 net::URLRequestStatus status = source->GetStatus();
128 const bool is_success = status.is_success(); 128 const bool is_success = status.is_success();
129 const int response_code = source->GetResponseCode(); 129 const int response_code = source->GetResponseCode();
130 SafeBrowsingProtocolManager::RecordHttpResponseOrErrorCode( 130 SafeBrowsingProtocolManager::RecordHttpResponseOrErrorCode(
131 kUmaModelDownloadResponseMetricName, status, response_code); 131 kUmaModelDownloadResponseMetricName, status, response_code);
132 132
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 199
200 void ModelLoader::CancelFetcher() { 200 void ModelLoader::CancelFetcher() {
201 // Invalidate any scheduled request. 201 // Invalidate any scheduled request.
202 weak_factory_.InvalidateWeakPtrs(); 202 weak_factory_.InvalidateWeakPtrs();
203 // Cancel any request in progress. 203 // Cancel any request in progress.
204 fetcher_.reset(); 204 fetcher_.reset();
205 } 205 }
206 206
207 } // namespace safe_browsing 207 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698