Chromium Code Reviews| Index: cc/resources/ui_resource_manager.h |
| =================================================================== |
| --- cc/resources/ui_resource_manager.h (revision 0) |
| +++ cc/resources/ui_resource_manager.h (revision 0) |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_RESOURCES_UI_RESOURCE_MANAGER_H_ |
| +#define CC_RESOURCES_UI_RESOURCE_MANAGER_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "ui/gfx/size.h" |
| + |
| +namespace cc { |
| + |
| +typedef int UIResourceId; |
| + |
| +class UIResourceManagerClient { |
|
aelias_OOO_until_Jul13
2013/07/10 23:07:22
Each class should be defined in a file with the sa
powei
2013/07/11 23:54:44
Done.
|
| + public: |
| + virtual ~UIResourceManagerClient() {} |
| + |
| + // This is called on the main thread when a recently created resource |
| + // has been fully uploaded to a texture. Users of large resources may |
| + // wish to wait for this callback before using the resource ID on a layer, |
| + // to avoid jank until the upload completes. |
| + virtual void UIResourceReady(UIResourceId id) = 0; |
|
aelias_OOO_until_Jul13
2013/07/10 23:07:22
Most users won't need to take any action for this
powei
2013/07/11 23:54:44
Done.
|
| +}; |
| + |
| +// Ref-counted bitmap class (can’t use SkBitmap because of ETC1) |
| +class UIResourceBitmap : public base::RefCountedThreadSafe<UIResourceBitmap> { |
|
aelias_OOO_until_Jul13
2013/07/10 23:07:22
Each class should be defined in a file with the sa
powei
2013/07/11 23:54:44
Done.
|
| + public: |
| + enum UIResourceFormat { |
| + RGBA8, |
| + ETC1 |
| + }; |
| + |
| + ~UIResourceBitmap(); |
| + |
| + // Takes ownership of “pixels”. |
| + static scoped_refptr<UIResourceBitmap> Create(void* pixels, |
| + UIResourceFormat format, |
| + gfx::Size size); |
| + |
| + gfx::Size GetSize() const { return size_; } |
| + UIResourceFormat GetFormat() const { return format_; } |
| + void* GetPixels() { return pixels_; } |
| + |
| + private: |
| + void* pixels_; |
| + UIResourceFormat format_; |
| + gfx::Size size_; |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_RESOURCES_UI_RESOURCE_MANAGER_H_ |