| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 TextureHolder_h | 5 #ifndef TextureHolder_h |
| 6 #define TextureHolder_h | 6 #define TextureHolder_h |
| 7 | 7 |
| 8 #include "gpu/command_buffer/common/mailbox.h" | 8 #include "gpu/command_buffer/common/mailbox.h" |
| 9 #include "gpu/command_buffer/common/sync_token.h" | 9 #include "gpu/command_buffer/common/sync_token.h" |
| 10 #include "platform/PlatformExport.h" | 10 #include "platform/PlatformExport.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 virtual void updateSyncToken(gpu::SyncToken) { NOTREACHED(); } | 39 virtual void updateSyncToken(gpu::SyncToken) { NOTREACHED(); } |
| 40 | 40 |
| 41 // Methods overrided by SkiaTextureHolder | 41 // Methods overrided by SkiaTextureHolder |
| 42 virtual sk_sp<SkImage> skImage() { | 42 virtual sk_sp<SkImage> skImage() { |
| 43 NOTREACHED(); | 43 NOTREACHED(); |
| 44 return nullptr; | 44 return nullptr; |
| 45 } | 45 } |
| 46 virtual void setSharedContextId(unsigned) { NOTREACHED(); } | 46 virtual void setSharedContextId(unsigned) { NOTREACHED(); } |
| 47 virtual void setImageThread(WebThread*) { NOTREACHED(); } | 47 virtual void setImageThread(WebThread*) { NOTREACHED(); } |
| 48 virtual void setImageThreadTaskRunner(std::unique_ptr<WebTaskRunner>) { | 48 virtual void setImageThreadTaskRunner(RefPtr<WebTaskRunner>) { NOTREACHED(); } |
| 49 NOTREACHED(); | |
| 50 } | |
| 51 | 49 |
| 52 // Methods that have exactly the same impelmentation for all sub-classes | 50 // Methods that have exactly the same impelmentation for all sub-classes |
| 53 bool wasTransferred() { return m_wasTransferred; } | 51 bool wasTransferred() { return m_wasTransferred; } |
| 54 WebTaskRunner* textureThreadTaskRunner() { | 52 RefPtr<WebTaskRunner> textureThreadTaskRunner() { |
| 55 return m_textureThreadTaskRunner.get(); | 53 return m_textureThreadTaskRunner; |
| 56 } | 54 } |
| 57 void setWasTransferred(bool flag) { m_wasTransferred = flag; } | 55 void setWasTransferred(bool flag) { m_wasTransferred = flag; } |
| 58 void setTextureThreadTaskRunner(std::unique_ptr<WebTaskRunner> taskRunner) { | 56 void setTextureThreadTaskRunner(RefPtr<WebTaskRunner> taskRunner) { |
| 59 m_textureThreadTaskRunner = std::move(taskRunner); | 57 m_textureThreadTaskRunner = std::move(taskRunner); |
| 60 } | 58 } |
| 61 | 59 |
| 62 private: | 60 private: |
| 63 // Wether the AcceleratedStaticBitmapImage that holds the |m_texture| was | 61 // Wether the AcceleratedStaticBitmapImage that holds the |m_texture| was |
| 64 // transferred to another thread or not. Set to false when the | 62 // transferred to another thread or not. Set to false when the |
| 65 // AcceleratedStaticBitmapImage remain on the same thread as it was craeted. | 63 // AcceleratedStaticBitmapImage remain on the same thread as it was craeted. |
| 66 bool m_wasTransferred = false; | 64 bool m_wasTransferred = false; |
| 67 // Keep a clone of the WebTaskRunner. This is to handle the case where the | 65 // Keep a clone of the WebTaskRunner. This is to handle the case where the |
| 68 // AcceleratedStaticBitmapImage was created on one thread and transferred to | 66 // AcceleratedStaticBitmapImage was created on one thread and transferred to |
| 69 // another thread, and the original thread gone out of scope, and that we need | 67 // another thread, and the original thread gone out of scope, and that we need |
| 70 // to clear the resouces associated with that AcceleratedStaticBitmapImage on | 68 // to clear the resouces associated with that AcceleratedStaticBitmapImage on |
| 71 // the original thread. | 69 // the original thread. |
| 72 std::unique_ptr<WebTaskRunner> m_textureThreadTaskRunner; | 70 RefPtr<WebTaskRunner> m_textureThreadTaskRunner; |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 } // namespace blink | 73 } // namespace blink |
| 76 | 74 |
| 77 #endif // TextureHolder_h | 75 #endif // TextureHolder_h |
| OLD | NEW |