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

Side by Side Diff: content/browser/android/ui_resource_provider_impl.h

Issue 287593002: android: content::UIResourceProvider and content::UIResourceClientAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: user->listener 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 2013 The Chromium Authors. All rights reserved.
David Trainor- moved to gerrit 2014/05/13 20:38:00 2014 here and all files
powei 2014/05/13 23:38:03 Done.
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 CONTENT_BROWSER_ANDROID_UI_RESOURCE_PROVIDER_IMPL_H_
6 #define CONTENT_BROWSER_ANDROID_UI_RESOURCE_PROVIDER_IMPL_H_
7
8 #include <list>
9
10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "cc/resources/ui_resource_client.h"
12 #include "content/public/browser/android/ui_resource_provider.h"
13
14 class SkBitmap;
15 class SkPixelRef;
16
17 namespace cc {
18 class LayerTreeHost;
19 class UIResourceClient;
20 }
21
22 namespace content {
23
24 class UIResourceListener;
25
26 class UIResourceProviderImpl : public UIResourceProvider {
27 public:
28 UIResourceProviderImpl();
29
30 ~UIResourceProviderImpl();
31
32 virtual void SetLayerTreeHost(cc::LayerTreeHost* host) OVERRIDE;
33
34 virtual void AddListener(UIResourceListener* listener) OVERRIDE;
35
36 virtual void RemoveListener(UIResourceListener* listener) OVERRIDE;
37
38 // Generates a UIResource and returns a UIResourceId. |is_transient|
39 // indicates whether or not to release the resource once the bitmap
David Trainor- moved to gerrit 2014/05/13 20:38:00 We release the resource right after building it?
powei 2014/05/13 23:38:03 See comment in cpp.
40 // has been uploaded. May return 0.
41 virtual cc::UIResourceId GenerateUIResource(const SkBitmap& bitmap,
42 bool is_transient) OVERRIDE;
43
44 // Generates an ETC1 compressed UIResource. See above for |is_transient|.
45 // May return 0.
46 virtual cc::UIResourceId GenerateCompressedUIResource(
47 const skia::RefPtr<SkPixelRef>& pixel_ref,
48 bool is_transient) OVERRIDE;
49
50 // Same as above method but makes a copy of |pixels|.
David Trainor- moved to gerrit 2014/05/13 20:38:00 :( copies so sad for large thumbnails...
51 // TODO(powei): should be removed once the thumbnail work is in place.
52 virtual cc::UIResourceId GenerateCompressedUIResource(
53 const gfx::Size& size,
54 void* pixels,
55 bool is_transient) OVERRIDE;
56
57 // Deletes a UIResource. We allow deleting a resource that is not allocated.
58 virtual void DeleteUIResource(cc::UIResourceId resource_id) OVERRIDE;
59
60 private:
61 void UIResourcesAreInvalid();
62 void RecreateUIResources();
63
64 cc::UIResourceId GenerateUIResourceFromUIResourceBitmap(
65 const cc::UIResourceBitmap& bitmap,
66 bool is_transient);
67
68 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::UIResourceClient>
69 UIResourceMap;
70 typedef std::list<UIResourceListener*> UIResourceListenerList;
71
72 UIResourceMap ui_resource_map_;
73 UIResourceListenerList listeners_;
74
75 cc::LayerTreeHost* host_;
76
77 DISALLOW_COPY_AND_ASSIGN(UIResourceProviderImpl);
78 };
79
80 } // namespace content
81
82 #endif // CONTENT_BROWSER_ANDROID_UI_RESOURCE_PROVIDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698