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

Side by Side Diff: components/bookmarks/core/browser/enhanced/image_store.h

Issue 259863007: Local salient image storage for enhanced bookmark experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor bookmarks.gypi clean up Created 6 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_BOOKMARKS_CORE_BROWSER_ENHANCED_IMAGE_STORE_H_
6 #define COMPONENTS_BOOKMARKS_CORE_BROWSER_ENHANCED_IMAGE_STORE_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/platform_thread.h"
14 #include "ui/gfx/image/image.h"
15
16 class GURL;
17
18 // The ImageStore keeps an image for each URL.
19 class ImageStore : public base::RefCounted<ImageStore> {
20 public:
21 ImageStore();
22
23 // Returns true if there is an image for this url.
24 virtual bool HasKey(const GURL& page_url) = 0;
25
26 // Inserts an image and its url in the store for the the given page url. The
27 // image can be null indicating that the download of the image at this URL
28 // failed previously.
29 virtual void Insert(const GURL& page_url,
30 const GURL& image_url,
31 const gfx::Image& image) = 0;
32
33 // Removes an image from the store.
34 virtual void Erase(const GURL& page_url) = 0;
35
36 // Returns the image associated with this url. Returns nil if there are no
37 // image for this url. It also returns the image_url where the image was
38 // downloaded from or failed to be downloaded from.
39 virtual gfx::Image Get(const GURL& page_url, GURL* image_url) = 0;
40
41 // Returns the size of the image stored for this URL or empty size if no
42 // images are present.
43 virtual gfx::Size GetSize(const GURL& page_url) = 0;
44
45 // Populates |url| with all the urls that have an image in the store.
46 virtual void GetAllPageUrls(std::vector<GURL>* urls) = 0;
47
48 // Moves an image from one url to another.
49 virtual void ChangeImageURL(const GURL& from, const GURL& to);
50
51 // Removes all images.
52 void ClearAll();
53
54 protected:
55 virtual ~ImageStore();
56
57 #if defined(DCHECK_IS_ON)
58 // At first call, it saves the current thread id to |running_thread_id_|. On
59 // subsequent calls, check if the current thread id is identical to
60 // |running_thread_id_|. Return false if calling thread id is different from
61 // previous threads.
62 bool IsRunningThreadConsistent();
noyau (Ping after 24h) 2014/05/04 17:27:12 Couldn't you use base::NonThreadSafe instead?
Kibeom Kim (inactive) 2014/05/05 17:35:47 Done. (didn't know NonThreadSafe, thanks!)
63
64 scoped_ptr<base::PlatformThreadId> running_thread_id_;
65 #endif
66
67 private:
68 friend class base::RefCounted<ImageStore>;
69 };
70
71 #endif // COMPONENTS_BOOKMARKS_CORE_BROWSER_ENHANCED_IMAGE_STORE_H_
OLDNEW
« no previous file with comments | « components/bookmarks/core/browser/enhanced/DEPS ('k') | components/bookmarks/core/browser/enhanced/image_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698