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

Side by Side Diff: ios/chrome/browser/net/image_fetcher.mm

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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 | « ios/chrome/browser/net/cookie_util.mm ('k') | ios/chrome/browser/net/image_fetcher_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "ios/chrome/browser/net/image_fetcher.h" 5 #import "ios/chrome/browser/net/image_fetcher.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Delegate callback that is called when URLFetcher completes. If the image 105 // Delegate callback that is called when URLFetcher completes. If the image
106 // was fetched successfully, creates a new NSData and returns it to the 106 // was fetched successfully, creates a new NSData and returns it to the
107 // callback, otherwise returns nil to the callback. 107 // callback, otherwise returns nil to the callback.
108 void ImageFetcher::OnURLFetchComplete(const net::URLFetcher* fetcher) { 108 void ImageFetcher::OnURLFetchComplete(const net::URLFetcher* fetcher) {
109 if (downloads_in_progress_.find(fetcher) == downloads_in_progress_.end()) { 109 if (downloads_in_progress_.find(fetcher) == downloads_in_progress_.end()) {
110 LOG(ERROR) << "Received callback for unknown URLFetcher " << fetcher; 110 LOG(ERROR) << "Received callback for unknown URLFetcher " << fetcher;
111 return; 111 return;
112 } 112 }
113 113
114 // Ensures that |fetcher| will be deleted in the event of early return. 114 // Ensures that |fetcher| will be deleted in the event of early return.
115 scoped_ptr<const net::URLFetcher> fetcher_deleter(fetcher); 115 std::unique_ptr<const net::URLFetcher> fetcher_deleter(fetcher);
116 116
117 // Retrieves the callback and ensures that it will be deleted in the event 117 // Retrieves the callback and ensures that it will be deleted in the event
118 // of early return. 118 // of early return.
119 base::mac::ScopedBlock<ImageFetchedCallback> callback( 119 base::mac::ScopedBlock<ImageFetchedCallback> callback(
120 downloads_in_progress_[fetcher]); 120 downloads_in_progress_[fetcher]);
121 121
122 // Remove |fetcher| from the map. 122 // Remove |fetcher| from the map.
123 downloads_in_progress_.erase(fetcher); 123 downloads_in_progress_.erase(fetcher);
124 124
125 // Make sure the request was successful. For "data" requests, the response 125 // Make sure the request was successful. For "data" requests, the response
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 NSData* data) { 169 NSData* data) {
170 (callback.get())(url, http_response_code, data); 170 (callback.get())(url, http_response_code, data);
171 } 171 }
172 172
173 void ImageFetcher::SetRequestContextGetter( 173 void ImageFetcher::SetRequestContextGetter(
174 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { 174 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) {
175 request_context_getter_ = request_context_getter; 175 request_context_getter_ = request_context_getter;
176 } 176 }
177 177
178 } // namespace image_fetcher 178 } // namespace image_fetcher
OLDNEW
« no previous file with comments | « ios/chrome/browser/net/cookie_util.mm ('k') | ios/chrome/browser/net/image_fetcher_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698