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

Unified Diff: cc/output/copy_output_request.h

Issue 15435003: cc: Add CopyAsBitmapRequest class to hold the readback callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nolint Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/output/copy_output_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/copy_output_request.h
diff --git a/cc/output/copy_output_request.h b/cc/output/copy_output_request.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0ef48b3809a912af89d1837784cc9feeb680ec7
--- /dev/null
+++ b/cc/output/copy_output_request.h
@@ -0,0 +1,45 @@
+// 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_OUTPUT_COPY_OUTPUT_REQUEST_H_
+#define CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/base/cc_export.h"
+
+class SkBitmap;
+
+namespace cc {
+
+class CC_EXPORT CopyOutputRequest {
+ public:
+ typedef base::Callback<void(scoped_ptr<SkBitmap>)> CopyAsBitmapCallback;
+
+ static scoped_ptr<CopyOutputRequest> CreateBitmapRequest(
+ const CopyAsBitmapCallback& bitmap_callback) {
+ return make_scoped_ptr(new CopyOutputRequest(bitmap_callback));
+ }
+
+ ~CopyOutputRequest();
+
+ bool IsEmpty() const { return !HasBitmapRequest(); }
+ bool HasBitmapRequest() const { return !bitmap_callback_.is_null(); }
+
+ void SendEmptyResult();
+ void SendBitmapResult(scoped_ptr<SkBitmap> bitmap);
+
+ bool Equals(const CopyOutputRequest& other) const {
+ return bitmap_callback_.Equals(other.bitmap_callback_);
+ }
+
+ private:
+ explicit CopyOutputRequest(const CopyAsBitmapCallback& callback);
+
+ CopyAsBitmapCallback bitmap_callback_;
+};
+
+} // namespace cc
+
+#endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/output/copy_output_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698