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

Side by Side Diff: components/image_fetcher/image_fetcher_impl.cc

Issue 2074153002: Pass the ImageDecoder to the ImageFetcher at creation time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments treib@, bauerb@ Created 4 years, 5 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/image_fetcher/image_fetcher_impl.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 "chrome/browser/search/suggestions/image_fetcher_impl.h" 5 #include "components/image_fetcher/image_fetcher_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
13 #include "net/url_request/url_request_context_getter.h" 11 #include "net/url_request/url_request_context_getter.h"
14 #include "ui/gfx/image/image.h"
15 12
16 namespace suggestions { 13 namespace image_fetcher {
17 14
18 ImageFetcherImpl::ImageFetcherImpl( 15 ImageFetcherImpl::ImageFetcherImpl(
16 std::unique_ptr<image_fetcher::ImageDecoder> image_decoder,
19 net::URLRequestContextGetter* url_request_context) 17 net::URLRequestContextGetter* url_request_context)
20 : delegate_(nullptr), url_request_context_(url_request_context), 18 : delegate_(nullptr), url_request_context_(url_request_context),
21 image_decoder_(new suggestions::ImageDecoderImpl()), 19 image_decoder_(std::move(image_decoder)),
22 image_data_fetcher_( 20 image_data_fetcher_(
23 new image_fetcher::ImageDataFetcher(url_request_context_)) { 21 new image_fetcher::ImageDataFetcher(url_request_context_.get())) {
Marc Treib 2016/06/29 14:41:33 nit: "image_fetcher::" isn't required anymore :)
markusheintz_ 2016/06/29 14:56:24 Done. Updated here and and in the rest of the file
24 } 22 }
25 23
26 ImageFetcherImpl::~ImageFetcherImpl() {} 24 ImageFetcherImpl::~ImageFetcherImpl() {}
27 25
28 ImageFetcherImpl::ImageRequest::ImageRequest() {} 26 ImageFetcherImpl::ImageRequest::ImageRequest() {}
29 27
30 ImageFetcherImpl::ImageRequest::ImageRequest(const ImageRequest& other) = 28 ImageFetcherImpl::ImageRequest::ImageRequest(const ImageRequest& other) =
31 default; 29 default;
32 30
33 ImageFetcherImpl::ImageRequest::~ImageRequest() { } 31 ImageFetcherImpl::ImageRequest::~ImageRequest() { }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 88
91 // Inform the ImageFetcherDelegate. 89 // Inform the ImageFetcherDelegate.
92 if (delegate_) { 90 if (delegate_) {
93 delegate_->OnImageFetched(request->id, image); 91 delegate_->OnImageFetched(request->id, image);
94 } 92 }
95 93
96 // Erase the completed ImageRequest. 94 // Erase the completed ImageRequest.
97 pending_net_requests_.erase(image_iter); 95 pending_net_requests_.erase(image_iter);
98 } 96 }
99 97
100 } // namespace suggestions 98 } // namespace image_fetcher
OLDNEW
« no previous file with comments | « components/image_fetcher/image_fetcher_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698