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

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

Issue 1864583006: Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" 12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "content/public/browser/storage_partition.h"
14 #include "net/base/load_flags.h" 15 #include "net/base/load_flags.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
16 17
17 namespace { 18 namespace {
18 19
19 const size_t kMaxRequests = 25; // Maximum number of inflight requests allowed. 20 const size_t kMaxRequests = 25; // Maximum number of inflight requests allowed.
20 const int kMaxCacheEntries = 5; // Maximum number of cache entries. 21 const int kMaxCacheEntries = 5; // Maximum number of cache entries.
21 22
22 } // namespace. 23 } // namespace.
23 24
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (url.is_valid()) 122 if (url.is_valid())
122 EnsureFetcherForUrl(url); 123 EnsureFetcherForUrl(url);
123 } 124 }
124 125
125 scoped_ptr<chrome::BitmapFetcher> BitmapFetcherService::CreateFetcher( 126 scoped_ptr<chrome::BitmapFetcher> BitmapFetcherService::CreateFetcher(
126 const GURL& url) { 127 const GURL& url) {
127 scoped_ptr<chrome::BitmapFetcher> new_fetcher( 128 scoped_ptr<chrome::BitmapFetcher> new_fetcher(
128 new chrome::BitmapFetcher(url, this)); 129 new chrome::BitmapFetcher(url, this));
129 130
130 new_fetcher->Init( 131 new_fetcher->Init(
131 context_->GetRequestContext(), 132 content::BrowserContext::GetDefaultStoragePartition(context_)->
133 GetURLRequestContext(),
132 std::string(), 134 std::string(),
133 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, 135 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
134 net::LOAD_NORMAL); 136 net::LOAD_NORMAL);
135 new_fetcher->Start(); 137 new_fetcher->Start();
136 return new_fetcher; 138 return new_fetcher;
137 } 139 }
138 140
139 const chrome::BitmapFetcher* BitmapFetcherService::EnsureFetcherForUrl( 141 const chrome::BitmapFetcher* BitmapFetcherService::EnsureFetcherForUrl(
140 const GURL& url) { 142 const GURL& url) {
141 const chrome::BitmapFetcher* fetcher = FindFetcherForUrl(url); 143 const chrome::BitmapFetcher* fetcher = FindFetcherForUrl(url);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 186 }
185 187
186 if (bitmap && !bitmap->isNull()) { 188 if (bitmap && !bitmap->isNull()) {
187 scoped_ptr<CacheEntry> entry(new CacheEntry); 189 scoped_ptr<CacheEntry> entry(new CacheEntry);
188 entry->bitmap.reset(new SkBitmap(*bitmap)); 190 entry->bitmap.reset(new SkBitmap(*bitmap));
189 cache_.Put(fetcher->url(), std::move(entry)); 191 cache_.Put(fetcher->url(), std::move(entry));
190 } 192 }
191 193
192 RemoveFetcher(fetcher); 194 RemoveFetcher(fetcher);
193 } 195 }
OLDNEW
« no previous file with comments | « blimp/engine/common/blimp_browser_context.cc ('k') | chrome/browser/browsing_data/browsing_data_remover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698