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

Side by Side Diff: chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc

Issue 314013003: [AiS] Add prefetching for Answers images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@img-bridge
Patch Set: Rebase to HEAD Created 6 years, 6 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 | « chrome/browser/autocomplete/base_search_provider.cc ('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/bitmap_fetcher/bitmap_fetcher_service.h" 5 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h"
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" 8 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // Make sure there's a fetcher for this URL and attach to request. 108 // Make sure there's a fetcher for this URL and attach to request.
109 const chrome::BitmapFetcher* fetcher = EnsureFetcherForUrl(url); 109 const chrome::BitmapFetcher* fetcher = EnsureFetcherForUrl(url);
110 request->set_fetcher(fetcher); 110 request->set_fetcher(fetcher);
111 111
112 requests_.push_back(request.release()); 112 requests_.push_back(request.release());
113 return requests_.back()->request_id(); 113 return requests_.back()->request_id();
114 } 114 }
115 115
116 void BitmapFetcherService::Prefetch(const GURL& url) { 116 void BitmapFetcherService::Prefetch(const GURL& url) {
117 EnsureFetcherForUrl(url); 117 if (url.is_valid())
sky 2014/06/20 15:13:56 If you're going to check the url here, shouldn't y
118 EnsureFetcherForUrl(url);
118 } 119 }
119 120
120 chrome::BitmapFetcher* BitmapFetcherService::CreateFetcher(const GURL& url) { 121 chrome::BitmapFetcher* BitmapFetcherService::CreateFetcher(const GURL& url) {
121 chrome::BitmapFetcher* new_fetcher = new chrome::BitmapFetcher(url, this); 122 chrome::BitmapFetcher* new_fetcher = new chrome::BitmapFetcher(url, this);
122 123
123 new_fetcher->Start( 124 new_fetcher->Start(
124 context_->GetRequestContext(), 125 context_->GetRequestContext(),
125 std::string(), 126 std::string(),
126 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, 127 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
127 net::LOAD_NORMAL); 128 net::LOAD_NORMAL);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 182 }
182 183
183 if (!bitmap->isNull()) { 184 if (!bitmap->isNull()) {
184 CacheEntry* entry = new CacheEntry; 185 CacheEntry* entry = new CacheEntry;
185 entry->bitmap.reset(new SkBitmap(*bitmap)); 186 entry->bitmap.reset(new SkBitmap(*bitmap));
186 cache_.Put(fetcher->url(), entry); 187 cache_.Put(fetcher->url(), entry);
187 } 188 }
188 189
189 RemoveFetcher(fetcher); 190 RemoveFetcher(fetcher);
190 } 191 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/base_search_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698