Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: ui/base/cursor/image_cursors.h

Issue 2978833002: Making CursorFactoryOzone thread-local (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/cursor/cursor_loader_ozone.cc ('k') | ui/base/cursor/image_cursors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cursor/image_cursors.h
diff --git a/ui/base/cursor/image_cursors.h b/ui/base/cursor/image_cursors.h
index 43b40e01f4055e01c25263cf1662e61f254e9684..4d6572a8dec59f7593fb0038e286fb75e3a5d4f1 100644
--- a/ui/base/cursor/image_cursors.h
+++ b/ui/base/cursor/image_cursors.h
@@ -8,6 +8,7 @@
#include <memory>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/ui_base_export.h"
@@ -25,6 +26,14 @@ class UI_BASE_EXPORT ImageCursors {
ImageCursors();
~ImageCursors();
+ // Creates the |cursor_loader_|. This is optional as |cursor_loader_| is
+ // lazily created if Initialize() isn't explictly called.
+ // However note that it matters which thread is used to create
+ // |cursor_loader_| (see CursorLoaderOzone, crbug.com/741106). Thus explicit
+ // call to Initialize may be useful to ensure initialization happens on the
+ // right thread.
+ void Initialize();
+
// Returns the scale and rotation of the currently loaded cursor.
float GetScale() const;
display::Display::Rotation GetRotation() const;
@@ -39,12 +48,15 @@ class UI_BASE_EXPORT ImageCursors {
// Sets the platform cursor based on the native type of |cursor|.
void SetPlatformCursor(gfx::NativeCursor* cursor);
+ base::WeakPtr<ImageCursors> GetWeakPtr();
+
private:
// Reloads the all loaded cursors in the cursor loader.
void ReloadCursors();
std::unique_ptr<CursorLoader> cursor_loader_;
CursorSize cursor_size_;
+ base::WeakPtrFactory<ImageCursors> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ImageCursors);
};
« no previous file with comments | « ui/base/cursor/cursor_loader_ozone.cc ('k') | ui/base/cursor/image_cursors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698