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

Unified Diff: content/browser/android/transient_ui_resource.h

Issue 143803004: android: Migrate old content readback to use async readback (and delegated renderer) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: turn clipping off for readback Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
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.
+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_

Powered by Google App Engine
This is Rietveld 408576698