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

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

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/image_cursors.h ('k') | ui/ozone/public/cursor_factory_ozone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cursor/image_cursors.cc
diff --git a/ui/base/cursor/image_cursors.cc b/ui/base/cursor/image_cursors.cc
index 93c25a9ae3d32f7c4b4a82167d5067b5486e5792..435fa5a06750a716e32c601800946c584c766036 100644
--- a/ui/base/cursor/image_cursors.cc
+++ b/ui/base/cursor/image_cursors.cc
@@ -60,11 +60,17 @@ const CursorType kAnimatedCursorIds[] = {CursorType::kWait,
} // namespace
-ImageCursors::ImageCursors() : cursor_size_(CursorSize::kNormal) {}
+ImageCursors::ImageCursors()
+ : cursor_size_(CursorSize::kNormal), weak_ptr_factory_(this) {}
ImageCursors::~ImageCursors() {
}
+void ImageCursors::Initialize() {
+ if (!cursor_loader_)
+ cursor_loader_.reset(CursorLoader::Create());
+}
+
float ImageCursors::GetScale() const {
if (!cursor_loader_) {
NOTREACHED();
@@ -142,4 +148,8 @@ void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) {
cursor_loader_->SetPlatformCursor(cursor);
}
+base::WeakPtr<ImageCursors> ImageCursors::GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
} // namespace ui
« no previous file with comments | « ui/base/cursor/image_cursors.h ('k') | ui/ozone/public/cursor_factory_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698