| 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 21 matching lines...) Expand all Loading... |
| 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(); |
| 41 bool IsDeletedForTesting(); | 41 bool IsDeletedForTesting(); |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace gpu | 104 } // namespace gpu |
| 104 | 105 |
| 105 #endif // GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ | 106 #endif // GPU_COMMAND_BUFFER_COMMON_DISCARDABLE_HANDLE_H_ |
| OLD | NEW |