| 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_TEXTURE_MAILBOX_DELETER_H_ | 5 #ifndef CC_OUTPUT_TEXTURE_MAILBOX_DELETER_H_ |
| 6 #define CC_OUTPUT_TEXTURE_MAILBOX_DELETER_H_ | 6 #define CC_OUTPUT_TEXTURE_MAILBOX_DELETER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 struct SyncToken; | 19 struct SyncToken; |
| 20 } | 20 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 32 ~TextureMailboxDeleter(); | 32 ~TextureMailboxDeleter(); |
| 33 | 33 |
| 34 // Returns a Callback that can be used as the ReleaseCallback for a | 34 // Returns a Callback that can be used as the ReleaseCallback for a |
| 35 // TextureMailbox attached to the |texture_id|. The ReleaseCallback can | 35 // TextureMailbox attached to the |texture_id|. The ReleaseCallback can |
| 36 // be passed to other threads and will destroy the texture, once it is | 36 // be passed to other threads and will destroy the texture, once it is |
| 37 // run, on the impl thread. If the TextureMailboxDeleter is destroyed | 37 // run, on the impl thread. If the TextureMailboxDeleter is destroyed |
| 38 // due to the compositor shutting down, then the ReleaseCallback will | 38 // due to the compositor shutting down, then the ReleaseCallback will |
| 39 // become a no-op and the texture will be deleted immediately on the | 39 // become a no-op and the texture will be deleted immediately on the |
| 40 // impl thread, along with dropping the reference to the ContextProvider. | 40 // impl thread, along with dropping the reference to the ContextProvider. |
| 41 scoped_ptr<SingleReleaseCallback> GetReleaseCallback( | 41 std::unique_ptr<SingleReleaseCallback> GetReleaseCallback( |
| 42 scoped_refptr<ContextProvider> context_provider, | 42 scoped_refptr<ContextProvider> context_provider, |
| 43 unsigned texture_id); | 43 unsigned texture_id); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // Runs the |impl_callback| to delete the texture and removes the callback | 46 // Runs the |impl_callback| to delete the texture and removes the callback |
| 47 // from the |impl_callbacks_| list. | 47 // from the |impl_callbacks_| list. |
| 48 void RunDeleteTextureOnImplThread(SingleReleaseCallback* impl_callback, | 48 void RunDeleteTextureOnImplThread(SingleReleaseCallback* impl_callback, |
| 49 const gpu::SyncToken& sync_token, | 49 const gpu::SyncToken& sync_token, |
| 50 bool is_lost); | 50 bool is_lost); |
| 51 | 51 |
| 52 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 52 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
| 53 std::vector<scoped_ptr<SingleReleaseCallback>> impl_callbacks_; | 53 std::vector<std::unique_ptr<SingleReleaseCallback>> impl_callbacks_; |
| 54 base::WeakPtrFactory<TextureMailboxDeleter> weak_ptr_factory_; | 54 base::WeakPtrFactory<TextureMailboxDeleter> weak_ptr_factory_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace cc | 57 } // namespace cc |
| 58 | 58 |
| 59 #endif // CC_OUTPUT_TEXTURE_MAILBOX_DELETER_H_ | 59 #endif // CC_OUTPUT_TEXTURE_MAILBOX_DELETER_H_ |
| OLD | NEW |