| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/thumbnails/thumbnail_service_impl.h" | 5 #include "chrome/browser/thumbnails/thumbnail_service_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/history/history_utils.h" | 10 #include "chrome/browser/history/history_utils.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 ThumbnailServiceImpl::~ThumbnailServiceImpl() { | 54 ThumbnailServiceImpl::~ThumbnailServiceImpl() { |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool ThumbnailServiceImpl::SetPageThumbnail(const ThumbnailingContext& context, | 57 bool ThumbnailServiceImpl::SetPageThumbnail(const ThumbnailingContext& context, |
| 58 const gfx::Image& thumbnail) { | 58 const gfx::Image& thumbnail) { |
| 59 scoped_refptr<history::TopSites> local_ptr(top_sites_); | 59 scoped_refptr<history::TopSites> local_ptr(top_sites_); |
| 60 if (!local_ptr) | 60 if (!local_ptr) |
| 61 return false; | 61 return false; |
| 62 | 62 |
| 63 return local_ptr->SetPageThumbnail(context.url, thumbnail, context.score); | 63 return local_ptr->SetPageThumbnail(context.GetURL(), thumbnail, |
| 64 context.score()); |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool ThumbnailServiceImpl::GetPageThumbnail( | 67 bool ThumbnailServiceImpl::GetPageThumbnail( |
| 67 const GURL& url, | 68 const GURL& url, |
| 68 bool prefix_match, | 69 bool prefix_match, |
| 69 scoped_refptr<base::RefCountedMemory>* bytes) { | 70 scoped_refptr<base::RefCountedMemory>* bytes) { |
| 70 scoped_refptr<history::TopSites> local_ptr(top_sites_); | 71 scoped_refptr<history::TopSites> local_ptr(top_sites_); |
| 71 if (!local_ptr) | 72 if (!local_ptr) |
| 72 return false; | 73 return false; |
| 73 | 74 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 121 } |
| 121 | 122 |
| 122 void ThumbnailServiceImpl::ShutdownOnUIThread() { | 123 void ThumbnailServiceImpl::ShutdownOnUIThread() { |
| 123 // Since each call uses its own scoped_refptr, we can just clear the reference | 124 // Since each call uses its own scoped_refptr, we can just clear the reference |
| 124 // here by assigning null. If another call is completed, it added its own | 125 // here by assigning null. If another call is completed, it added its own |
| 125 // reference. | 126 // reference. |
| 126 top_sites_ = NULL; | 127 top_sites_ = NULL; |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace thumbnails | 130 } // namespace thumbnails |
| OLD | NEW |