OLD | NEW |
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> |
| 8 |
| 9 #include "base/macros.h" |
7 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
8 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
9 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
10 #include "net/base/load_flags.h" | 13 #include "net/base/load_flags.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
12 | 15 |
13 namespace { | 16 namespace { |
14 | 17 |
15 const size_t kMaxRequests = 25; // Maximum number of inflight requests allowed. | 18 const size_t kMaxRequests = 25; // Maximum number of inflight requests allowed. |
16 const int kMaxCacheEntries = 5; // Maximum number of cache entries. | 19 const int kMaxCacheEntries = 5; // Maximum number of cache entries. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 183 } |
181 | 184 |
182 if (bitmap && !bitmap->isNull()) { | 185 if (bitmap && !bitmap->isNull()) { |
183 CacheEntry* entry = new CacheEntry; | 186 CacheEntry* entry = new CacheEntry; |
184 entry->bitmap.reset(new SkBitmap(*bitmap)); | 187 entry->bitmap.reset(new SkBitmap(*bitmap)); |
185 cache_.Put(fetcher->url(), entry); | 188 cache_.Put(fetcher->url(), entry); |
186 } | 189 } |
187 | 190 |
188 RemoveFetcher(fetcher); | 191 RemoveFetcher(fetcher); |
189 } | 192 } |
OLD | NEW |