diff options
Diffstat (limited to 'cc/output/copy_output_request.h')
-rw-r--r-- | cc/output/copy_output_request.h | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/cc/output/copy_output_request.h b/cc/output/copy_output_request.h index d0ef48b..54fff1a 100644 --- a/cc/output/copy_output_request.h +++ b/cc/output/copy_output_request.h @@ -8,36 +8,59 @@ #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "cc/base/cc_export.h" +#include "ui/gfx/size.h" class SkBitmap; namespace cc { +class CopyOutputResult; +class TextureMailbox; class CC_EXPORT CopyOutputRequest { public: - typedef base::Callback<void(scoped_ptr<SkBitmap>)> CopyAsBitmapCallback; + typedef base::Callback<void(scoped_ptr<CopyOutputResult> result)> + CopyOutputRequestCallback; + static scoped_ptr<CopyOutputRequest> CreateEmptyRequest() { + return make_scoped_ptr(new CopyOutputRequest); + } + static scoped_ptr<CopyOutputRequest> CreateRequest( + const CopyOutputRequestCallback& result_callback) { + return make_scoped_ptr(new CopyOutputRequest(false, result_callback)); + } static scoped_ptr<CopyOutputRequest> CreateBitmapRequest( - const CopyAsBitmapCallback& bitmap_callback) { - return make_scoped_ptr(new CopyOutputRequest(bitmap_callback)); + const CopyOutputRequestCallback& result_callback) { + return make_scoped_ptr(new CopyOutputRequest(true, result_callback)); + } + static scoped_ptr<CopyOutputRequest> CreateRelayRequest( + const CopyOutputRequest& original_request, + const CopyOutputRequestCallback& result_callback) { + return make_scoped_ptr(new CopyOutputRequest( + original_request.force_bitmap_result(), result_callback)); } ~CopyOutputRequest(); - bool IsEmpty() const { return !HasBitmapRequest(); } - bool HasBitmapRequest() const { return !bitmap_callback_.is_null(); } + bool IsEmpty() const { return result_callback_.is_null(); } + bool force_bitmap_result() const { return force_bitmap_result_; } - void SendEmptyResult(); + void SendResult(scoped_ptr<CopyOutputResult> result); void SendBitmapResult(scoped_ptr<SkBitmap> bitmap); + void SendTextureResult(gfx::Size size, + scoped_ptr<TextureMailbox> texture_mailbox); bool Equals(const CopyOutputRequest& other) const { - return bitmap_callback_.Equals(other.bitmap_callback_); + return result_callback_.Equals(other.result_callback_) && + force_bitmap_result_ == other.force_bitmap_result_; } private: - explicit CopyOutputRequest(const CopyAsBitmapCallback& callback); + CopyOutputRequest(); + explicit CopyOutputRequest(bool force_bitmap_result, + const CopyOutputRequestCallback& result_callback); - CopyAsBitmapCallback bitmap_callback_; + bool force_bitmap_result_; + CopyOutputRequestCallback result_callback_; }; } // namespace cc |