Chromium Code Reviews| 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_REQUEST_H_ | 5 #ifndef CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ |
| 6 #define CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ | 6 #define CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 bool has_area() const { return area_.has_value(); } | 67 bool has_area() const { return area_.has_value(); } |
| 68 const gfx::Rect& area() const { return *area_; } | 68 const gfx::Rect& area() const { return *area_; } |
| 69 | 69 |
| 70 // By default copy requests create a new TextureMailbox to return contents | 70 // By default copy requests create a new TextureMailbox to return contents |
| 71 // in. This allows a client to provide a TextureMailbox, and the compositor | 71 // in. This allows a client to provide a TextureMailbox, and the compositor |
| 72 // will place the result inside the TextureMailbox. | 72 // will place the result inside the TextureMailbox. |
| 73 void SetTextureMailbox(const TextureMailbox& texture_mailbox); | 73 void SetTextureMailbox(const TextureMailbox& texture_mailbox); |
| 74 bool has_texture_mailbox() const { return texture_mailbox_.has_value(); } | 74 bool has_texture_mailbox() const { return texture_mailbox_.has_value(); } |
| 75 const TextureMailbox& texture_mailbox() const { return *texture_mailbox_; } | 75 const TextureMailbox& texture_mailbox() const { return *texture_mailbox_; } |
| 76 | 76 |
| 77 void set_result_callback(CopyOutputRequestCallback result_callback) { | |
|
Fady Samuel
2017/02/15 13:32:20
Is this still necessary? Thanks!
Saman Sami
2017/02/15 22:53:56
Not after my other CL lands. I'll get rid of it.
| |
| 78 result_callback_ = result_callback; | |
| 79 } | |
| 80 const CopyOutputRequestCallback& result_callback() { | |
| 81 return result_callback_; | |
| 82 } | |
| 83 | |
| 77 void SendEmptyResult(); | 84 void SendEmptyResult(); |
| 78 void SendBitmapResult(std::unique_ptr<SkBitmap> bitmap); | 85 void SendBitmapResult(std::unique_ptr<SkBitmap> bitmap); |
| 79 void SendTextureResult( | 86 void SendTextureResult( |
| 80 const gfx::Size& size, | 87 const gfx::Size& size, |
| 81 const TextureMailbox& texture_mailbox, | 88 const TextureMailbox& texture_mailbox, |
| 82 std::unique_ptr<SingleReleaseCallback> release_callback); | 89 std::unique_ptr<SingleReleaseCallback> release_callback); |
| 83 | 90 |
| 84 void SendResult(std::unique_ptr<CopyOutputResult> result); | 91 void SendResult(std::unique_ptr<CopyOutputResult> result); |
| 85 | 92 |
| 86 private: | 93 private: |
| 87 friend struct mojo::StructTraits<mojom::CopyOutputRequestDataView, | 94 friend struct mojo::StructTraits<mojom::CopyOutputRequestDataView, |
| 88 std::unique_ptr<CopyOutputRequest>>; | 95 std::unique_ptr<CopyOutputRequest>>; |
| 89 | 96 |
| 90 CopyOutputRequest(); | 97 CopyOutputRequest(); |
| 91 CopyOutputRequest(bool force_bitmap_result, | 98 CopyOutputRequest(bool force_bitmap_result, |
| 92 const CopyOutputRequestCallback& result_callback); | 99 const CopyOutputRequestCallback& result_callback); |
| 93 | 100 |
| 94 base::Optional<base::UnguessableToken> source_; | 101 base::Optional<base::UnguessableToken> source_; |
| 95 bool force_bitmap_result_; | 102 bool force_bitmap_result_; |
| 96 base::Optional<gfx::Rect> area_; | 103 base::Optional<gfx::Rect> area_; |
| 97 base::Optional<TextureMailbox> texture_mailbox_; | 104 base::Optional<TextureMailbox> texture_mailbox_; |
| 98 CopyOutputRequestCallback result_callback_; | 105 CopyOutputRequestCallback result_callback_; |
| 99 | 106 |
| 100 DISALLOW_COPY_AND_ASSIGN(CopyOutputRequest); | 107 DISALLOW_COPY_AND_ASSIGN(CopyOutputRequest); |
| 101 }; | 108 }; |
| 102 | 109 |
| 103 } // namespace cc | 110 } // namespace cc |
| 104 | 111 |
| 105 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ | 112 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ |
| OLD | NEW |