| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_OUTPUT_COPY_OUTPUT_RESULT_H_ | 5 #ifndef CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
| 6 #define CC_OUTPUT_COPY_OUTPUT_RESULT_H_ | 6 #define CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return base::WrapUnique(new CopyOutputResult(std::move(bitmap))); | 35 return base::WrapUnique(new CopyOutputResult(std::move(bitmap))); |
| 36 } | 36 } |
| 37 static std::unique_ptr<CopyOutputResult> CreateTextureResult( | 37 static std::unique_ptr<CopyOutputResult> CreateTextureResult( |
| 38 const gfx::Size& size, | 38 const gfx::Size& size, |
| 39 const TextureMailbox& texture_mailbox, | 39 const TextureMailbox& texture_mailbox, |
| 40 std::unique_ptr<SingleReleaseCallback> release_callback) { | 40 std::unique_ptr<SingleReleaseCallback> release_callback) { |
| 41 return base::WrapUnique(new CopyOutputResult(size, texture_mailbox, | 41 return base::WrapUnique(new CopyOutputResult(size, texture_mailbox, |
| 42 std::move(release_callback))); | 42 std::move(release_callback))); |
| 43 } | 43 } |
| 44 | 44 |
| 45 CopyOutputResult(); | |
| 46 | |
| 47 CopyOutputResult(CopyOutputResult&& other); | |
| 48 | |
| 49 ~CopyOutputResult(); | 45 ~CopyOutputResult(); |
| 50 | 46 |
| 51 CopyOutputResult& operator=(CopyOutputResult&& other); | |
| 52 | |
| 53 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } | 47 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } |
| 54 bool HasBitmap() const { return !!bitmap_ && !bitmap_->isNull(); } | 48 bool HasBitmap() const { return !!bitmap_ && !bitmap_->isNull(); } |
| 55 bool HasTexture() const { return texture_mailbox_.IsValid(); } | 49 bool HasTexture() const { return texture_mailbox_.IsValid(); } |
| 56 | 50 |
| 57 gfx::Size size() const { return size_; } | 51 gfx::Size size() const { return size_; } |
| 58 std::unique_ptr<SkBitmap> TakeBitmap(); | 52 std::unique_ptr<SkBitmap> TakeBitmap(); |
| 59 void TakeTexture(TextureMailbox* texture_mailbox, | 53 void TakeTexture(TextureMailbox* texture_mailbox, |
| 60 std::unique_ptr<SingleReleaseCallback>* release_callback); | 54 std::unique_ptr<SingleReleaseCallback>* release_callback); |
| 61 | 55 |
| 62 private: | 56 private: |
| 63 friend struct mojo::StructTraits<mojom::CopyOutputResultDataView, | 57 friend struct mojo::StructTraits<mojom::CopyOutputResultDataView, |
| 64 CopyOutputResult>; | 58 std::unique_ptr<CopyOutputResult>>; |
| 65 | 59 |
| 60 CopyOutputResult(); |
| 66 explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap); | 61 explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap); |
| 67 explicit CopyOutputResult( | 62 explicit CopyOutputResult( |
| 68 const gfx::Size& size, | 63 const gfx::Size& size, |
| 69 const TextureMailbox& texture_mailbox, | 64 const TextureMailbox& texture_mailbox, |
| 70 std::unique_ptr<SingleReleaseCallback> release_callback); | 65 std::unique_ptr<SingleReleaseCallback> release_callback); |
| 71 | 66 |
| 72 gfx::Size size_; | 67 gfx::Size size_; |
| 73 std::unique_ptr<SkBitmap> bitmap_; | 68 std::unique_ptr<SkBitmap> bitmap_; |
| 74 TextureMailbox texture_mailbox_; | 69 TextureMailbox texture_mailbox_; |
| 75 std::unique_ptr<SingleReleaseCallback> release_callback_; | 70 std::unique_ptr<SingleReleaseCallback> release_callback_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(CopyOutputResult); |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 } // namespace cc | 75 } // namespace cc |
| 79 | 76 |
| 80 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ | 77 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
| OLD | NEW |