| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ |
| 6 #define GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "gpu/gpu_export.h" | 9 #include "gpu/gpu_export.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // ╚════════════╝ ╚════════════╝ ╚═══════════╝ | 30 // ╚════════════╝ ╚════════════╝ ╚═══════════╝ |
| 31 // └───────────<──────────┘ | 31 // └───────────<──────────┘ |
| 32 // | 32 // |
| 33 // Note that a handle can be locked multiple times, and stores a lock-count. | 33 // Note that a handle can be locked multiple times, and stores a lock-count. |
| 34 class GPU_EXPORT DiscardableHandleBase { | 34 class GPU_EXPORT DiscardableHandleBase { |
| 35 public: | 35 public: |
| 36 int32_t shm_id() const { return shm_id_; } | 36 int32_t shm_id() const { return shm_id_; } |
| 37 uint32_t byte_offset() const { return byte_offset_; } | 37 uint32_t byte_offset() const { return byte_offset_; } |
| 38 | 38 |
| 39 // Test only functions. | 39 // Test only functions. |
| 40 bool IsLockedForTesting(); | 40 bool IsLockedForTesting() const; |
| 41 bool IsDeletedForTesting(); | 41 bool IsDeletedForTesting() const; |
| 42 scoped_refptr<Buffer> BufferForTesting() const { return buffer_; } |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 DiscardableHandleBase(scoped_refptr<Buffer> buffer, | 45 DiscardableHandleBase(scoped_refptr<Buffer> buffer, |
| 45 uint32_t byte_offset, | 46 uint32_t byte_offset, |
| 46 int32_t shm_id); | 47 int32_t shm_id); |
| 47 DiscardableHandleBase(const DiscardableHandleBase& other); | 48 DiscardableHandleBase(const DiscardableHandleBase& other); |
| 48 DiscardableHandleBase(DiscardableHandleBase&& other); | 49 DiscardableHandleBase(DiscardableHandleBase&& other); |
| 49 DiscardableHandleBase& operator=(const DiscardableHandleBase& other); | 50 DiscardableHandleBase& operator=(const DiscardableHandleBase& other); |
| 50 DiscardableHandleBase& operator=(DiscardableHandleBase&& other); | 51 DiscardableHandleBase& operator=(DiscardableHandleBase&& other); |
| 51 ~DiscardableHandleBase(); | 52 ~DiscardableHandleBase(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 ServiceDiscardableHandle& operator=(const ServiceDiscardableHandle& other); | 92 ServiceDiscardableHandle& operator=(const ServiceDiscardableHandle& other); |
| 92 ServiceDiscardableHandle& operator=(ServiceDiscardableHandle&& other); | 93 ServiceDiscardableHandle& operator=(ServiceDiscardableHandle&& other); |
| 93 | 94 |
| 94 // Unlocks the handle. This should always be paired with a client-side call | 95 // Unlocks the handle. This should always be paired with a client-side call |
| 95 // to lock, or with a new handle, which starts locked. | 96 // to lock, or with a new handle, which starts locked. |
| 96 void Unlock(); | 97 void Unlock(); |
| 97 | 98 |
| 98 // Tries to delete the handle. Returns true if successfully deleted. Returns | 99 // Tries to delete the handle. Returns true if successfully deleted. Returns |
| 99 // false if the handle is locked client-side and cannot be deleted. | 100 // false if the handle is locked client-side and cannot be deleted. |
| 100 bool Delete(); | 101 bool Delete(); |
| 102 |
| 103 // Deletes the handle, regardless of the handle's state. This should be |
| 104 // called in response to glDeleteTextures, which may be called while the |
| 105 // handle is in the locked or unlocked state. |
| 106 void ForceDelete(); |
| 101 }; | 107 }; |
| 102 | 108 |
| 103 } // namespace gpu | 109 } // namespace gpu |
| 104 | 110 |
| 105 #endif // GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ | 111 #endif // GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ |
| OLD | NEW |