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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } | 47 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } |
48 bool HasBitmap() const { return !!bitmap_ && !bitmap_->isNull(); } | 48 bool HasBitmap() const { return !!bitmap_ && !bitmap_->isNull(); } |
49 bool HasTexture() const { return texture_mailbox_.IsValid(); } | 49 bool HasTexture() const { return texture_mailbox_.IsValid(); } |
50 | 50 |
51 gfx::Size size() const { return size_; } | 51 gfx::Size size() const { return size_; } |
52 std::unique_ptr<SkBitmap> TakeBitmap(); | 52 std::unique_ptr<SkBitmap> TakeBitmap(); |
53 void TakeTexture(TextureMailbox* texture_mailbox, | 53 void TakeTexture(TextureMailbox* texture_mailbox, |
54 std::unique_ptr<SingleReleaseCallback>* release_callback); | 54 std::unique_ptr<SingleReleaseCallback>* release_callback); |
55 | 55 |
| 56 std::unique_ptr<SingleReleaseCallback> TakeReleaseCallback(); |
| 57 |
| 58 void set_release_callback(std::unique_ptr<SingleReleaseCallback> callback) { |
| 59 release_callback_ = std::move(callback); |
| 60 } |
| 61 |
| 62 const gpu::Mailbox& mailbox() { return texture_mailbox_.mailbox(); } |
| 63 |
56 private: | 64 private: |
57 friend struct mojo::StructTraits<mojom::CopyOutputResultDataView, | 65 friend struct mojo::StructTraits<mojom::CopyOutputResultDataView, |
58 std::unique_ptr<CopyOutputResult>>; | 66 std::unique_ptr<CopyOutputResult>>; |
59 | 67 |
60 CopyOutputResult(); | 68 CopyOutputResult(); |
61 explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap); | 69 explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap); |
62 explicit CopyOutputResult( | 70 explicit CopyOutputResult( |
63 const gfx::Size& size, | 71 const gfx::Size& size, |
64 const TextureMailbox& texture_mailbox, | 72 const TextureMailbox& texture_mailbox, |
65 std::unique_ptr<SingleReleaseCallback> release_callback); | 73 std::unique_ptr<SingleReleaseCallback> release_callback); |
66 | 74 |
67 gfx::Size size_; | 75 gfx::Size size_; |
68 std::unique_ptr<SkBitmap> bitmap_; | 76 std::unique_ptr<SkBitmap> bitmap_; |
69 TextureMailbox texture_mailbox_; | 77 TextureMailbox texture_mailbox_; |
70 std::unique_ptr<SingleReleaseCallback> release_callback_; | 78 std::unique_ptr<SingleReleaseCallback> release_callback_; |
71 | 79 |
72 DISALLOW_COPY_AND_ASSIGN(CopyOutputResult); | 80 DISALLOW_COPY_AND_ASSIGN(CopyOutputResult); |
73 }; | 81 }; |
74 | 82 |
75 } // namespace cc | 83 } // namespace cc |
76 | 84 |
77 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ | 85 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
OLD | NEW |