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

Unified Diff: cc/output/copy_output_result.h

Issue 2659703002: Implemented StructTraits for cc::CopyOutputResult (Closed)
Patch Set: c Created 3 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
« no previous file with comments | « cc/ipc/typemaps.gni ('k') | cc/output/copy_output_result.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/copy_output_result.h
diff --git a/cc/output/copy_output_result.h b/cc/output/copy_output_result.h
index a64fc5108ef4cc46ce8cead0e9dfac49ea83bc84..cca1270b09bf112eaeb56a01ffe110ff846f734e 100644
--- a/cc/output/copy_output_result.h
+++ b/cc/output/copy_output_result.h
@@ -11,11 +11,18 @@
#include "cc/base/cc_export.h"
#include "cc/resources/single_release_callback.h"
#include "cc/resources/texture_mailbox.h"
+#include "mojo/public/cpp/bindings/struct_traits.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"
class SkBitmap;
namespace cc {
+
+namespace mojom {
+class CopyOutputResultDataView;
+}
+
class TextureMailbox;
class CC_EXPORT CopyOutputResult {
@@ -35,10 +42,16 @@ class CC_EXPORT CopyOutputResult {
std::move(release_callback)));
}
+ CopyOutputResult();
+
+ CopyOutputResult(CopyOutputResult&& other);
+
~CopyOutputResult();
+ CopyOutputResult& operator=(CopyOutputResult&& other);
+
bool IsEmpty() const { return !HasBitmap() && !HasTexture(); }
- bool HasBitmap() const { return !!bitmap_; }
+ bool HasBitmap() const { return !!bitmap_ && !bitmap_->isNull(); }
bool HasTexture() const { return texture_mailbox_.IsValid(); }
gfx::Size size() const { return size_; }
@@ -47,7 +60,9 @@ class CC_EXPORT CopyOutputResult {
std::unique_ptr<SingleReleaseCallback>* release_callback);
private:
- CopyOutputResult();
+ friend struct mojo::StructTraits<mojom::CopyOutputResultDataView,
+ CopyOutputResult>;
+
explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap);
explicit CopyOutputResult(
const gfx::Size& size,
« no previous file with comments | « cc/ipc/typemaps.gni ('k') | cc/output/copy_output_result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698