| 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" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/resources/single_release_callback.h" | 12 #include "cc/resources/single_release_callback.h" |
| 13 #include "cc/resources/texture_mailbox.h" | 13 #include "cc/resources/texture_mailbox.h" |
| 14 #include "cc/resources/texture_mailbox_releaser_provider.h" |
| 14 #include "mojo/public/cpp/bindings/struct_traits.h" | 15 #include "mojo/public/cpp/bindings/struct_traits.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 | 20 |
| 20 namespace cc { | 21 namespace cc { |
| 21 | 22 |
| 22 namespace mojom { | 23 namespace mojom { |
| 23 class CopyOutputResultDataView; | 24 class CopyOutputResultDataView; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } | 48 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } |
| 48 bool HasBitmap() const { return !!bitmap_ && !bitmap_->isNull(); } | 49 bool HasBitmap() const { return !!bitmap_ && !bitmap_->isNull(); } |
| 49 bool HasTexture() const { return texture_mailbox_.IsValid(); } | 50 bool HasTexture() const { return texture_mailbox_.IsValid(); } |
| 50 | 51 |
| 51 gfx::Size size() const { return size_; } | 52 gfx::Size size() const { return size_; } |
| 52 std::unique_ptr<SkBitmap> TakeBitmap(); | 53 std::unique_ptr<SkBitmap> TakeBitmap(); |
| 53 void TakeTexture(TextureMailbox* texture_mailbox, | 54 void TakeTexture(TextureMailbox* texture_mailbox, |
| 54 std::unique_ptr<SingleReleaseCallback>* release_callback); | 55 std::unique_ptr<SingleReleaseCallback>* release_callback); |
| 55 | 56 |
| 57 void set_ptr_provider(TextureMailboxReleaserProvider* ptr_provider) { |
| 58 ptr_provider_ = ptr_provider; |
| 59 } |
| 60 |
| 56 private: | 61 private: |
| 57 friend struct mojo::StructTraits<mojom::CopyOutputResultDataView, | 62 friend struct mojo::StructTraits<mojom::CopyOutputResultDataView, |
| 58 std::unique_ptr<CopyOutputResult>>; | 63 std::unique_ptr<CopyOutputResult>>; |
| 59 | 64 |
| 60 CopyOutputResult(); | 65 CopyOutputResult(); |
| 61 explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap); | 66 explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap); |
| 62 explicit CopyOutputResult( | 67 explicit CopyOutputResult( |
| 63 const gfx::Size& size, | 68 const gfx::Size& size, |
| 64 const TextureMailbox& texture_mailbox, | 69 const TextureMailbox& texture_mailbox, |
| 65 std::unique_ptr<SingleReleaseCallback> release_callback); | 70 std::unique_ptr<SingleReleaseCallback> release_callback); |
| 66 | 71 |
| 67 gfx::Size size_; | 72 gfx::Size size_; |
| 68 std::unique_ptr<SkBitmap> bitmap_; | 73 std::unique_ptr<SkBitmap> bitmap_; |
| 69 TextureMailbox texture_mailbox_; | 74 TextureMailbox texture_mailbox_; |
| 70 std::unique_ptr<SingleReleaseCallback> release_callback_; | 75 std::unique_ptr<SingleReleaseCallback> release_callback_; |
| 76 TextureMailboxReleaserProvider* ptr_provider_ = nullptr; |
| 71 | 77 |
| 72 DISALLOW_COPY_AND_ASSIGN(CopyOutputResult); | 78 DISALLOW_COPY_AND_ASSIGN(CopyOutputResult); |
| 73 }; | 79 }; |
| 74 | 80 |
| 75 } // namespace cc | 81 } // namespace cc |
| 76 | 82 |
| 77 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ | 83 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
| OLD | NEW |