Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors |
Henrique Ferreiro | 070fa84 | 2021-04-21 00:52:11 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UI_BASE_CURSOR_PLATFORM_CURSOR_H_ |
| 6 | #define UI_BASE_CURSOR_PLATFORM_CURSOR_H_ |
| 7 | |
| 8 | #include "base/component_export.h" |
| 9 | #include "base/memory/ref_counted.h" |
| 10 | |
| 11 | namespace ui { |
| 12 | |
| 13 | // Ref-counted base class for platform-specific cursors. |
| 14 | // |
| 15 | // Sub-classes of PlatformCursor are expected to wrap platform-specific cursor |
| 16 | // resources (e.g. HCURSOR on Windows). Those resources also have |
| 17 | // platform-specific deletion methods that must only be called once the last |
| 18 | // cursor is destroyed, thus requiring a ref-counted type. |
| 19 | // While default cursors (all other than kCustom in |
| 20 | // ui/base/cursor/cursor_type.mojom) are used often during any Chrome session |
| 21 | // and could perhaps be kept alive for the duration of the program, custom |
| 22 | // cursors might incur in high memory usage. Because of this, all types of |
| 23 | // cursors are expected to be ref-counted. |
Henrique Ferreiro | 5a79d866 | 2021-12-07 14:56:42 | [diff] [blame] | 24 | class COMPONENT_EXPORT(UI_BASE_CURSOR) PlatformCursor |
Henrique Ferreiro | 070fa84 | 2021-04-21 00:52:11 | [diff] [blame] | 25 | : public base::RefCounted<PlatformCursor> { |
| 26 | public: |
| 27 | REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE(); |
| 28 | |
| 29 | protected: |
| 30 | friend class base::RefCounted<PlatformCursor>; |
| 31 | virtual ~PlatformCursor() = default; |
| 32 | }; |
| 33 | |
| 34 | } // namespace ui |
| 35 | |
| 36 | #endif // UI_BASE_CURSOR_PLATFORM_CURSOR_H_ |