Chromium Code Reviews| Index: content/browser/android/transient_ui_resource.h |
| diff --git a/content/browser/android/transient_ui_resource.h b/content/browser/android/transient_ui_resource.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..478f72bbcc6a11c64aefc662759bf8ab504e8347 |
| --- /dev/null |
| +++ b/content/browser/android/transient_ui_resource.h |
| @@ -0,0 +1,49 @@ |
| +// 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 CONTENT_BROWSER_ANDROID_TRANSIENT_UI_RESOURCE_H_ |
| +#define CONTENT_BROWSER_ANDROID_TRANSIENT_UI_RESOURCE_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "cc/resources/ui_resource_client.h" |
| +#include "ui/gfx/size.h" |
| + |
| +namespace cc { |
| + |
| +class LayerTreeHost; |
| +class UIResourceBitmap; |
| + |
| +} |
| + |
| +namespace content { |
| + |
| +// This UIResourceClient immediately frees the pixels after it has been queried |
| +// once. Subsequent GetBitmap() calls will return a small holder. |
|
no sievers
2014/01/28 20:47:22
Do we really need this class? The way this works,
powei
2014/01/29 13:53:17
Done.
|
| +class TransientUIResource : public cc::UIResourceClient { |
| + public: |
| + static scoped_ptr<TransientUIResource> Create( |
| + cc::LayerTreeHost* host, |
| + const cc::UIResourceBitmap& bitmap); |
| + virtual ~TransientUIResource(); |
| + |
| + // UIResourceClient implementation. |
| + virtual cc::UIResourceBitmap GetBitmap(cc::UIResourceId uid, |
| + bool resource_lost) OVERRIDE; |
| + cc::UIResourceId id() { return id_; } |
| + |
| + protected: |
| + TransientUIResource(cc::LayerTreeHost* host, |
| + const cc::UIResourceBitmap& bitmap); |
| + |
| + scoped_ptr<cc::UIResourceBitmap> bitmap_; |
| + cc::LayerTreeHost* host_; |
| + cc::UIResourceId id_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(TransientUIResource); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_ANDROID_TRANSIENT_UI_RESOURCE_H_ |