blob: ad3ed108693cf1c24e31ad1c485db4e6fa683011 [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2021 The Chromium Authors
Henrique Ferreiro070fa842021-04-21 00:52:112// 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
11namespace 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 Ferreiro5a79d8662021-12-07 14:56:4224class COMPONENT_EXPORT(UI_BASE_CURSOR) PlatformCursor
Henrique Ferreiro070fa842021-04-21 00:52:1125 : 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_