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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ui/base/cursor/image_cursors.h" 5 #include "ui/base/cursor/image_cursors.h"
6 6
7 #include <float.h> 7 #include <float.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 CursorType::kNorthWestSouthEastResize, 53 CursorType::kNorthWestSouthEastResize,
54 CursorType::kGrab, 54 CursorType::kGrab,
55 CursorType::kGrabbing, 55 CursorType::kGrabbing,
56 }; 56 };
57 57
58 const CursorType kAnimatedCursorIds[] = {CursorType::kWait, 58 const CursorType kAnimatedCursorIds[] = {CursorType::kWait,
59 CursorType::kProgress}; 59 CursorType::kProgress};
60 60
61 } // namespace 61 } // namespace
62 62
63 ImageCursors::ImageCursors() : cursor_size_(CursorSize::kNormal) {} 63 ImageCursors::ImageCursors()
64 : cursor_size_(CursorSize::kNormal), weak_ptr_factory_(this) {}
64 65
65 ImageCursors::~ImageCursors() { 66 ImageCursors::~ImageCursors() {
66 } 67 }
67 68
69 void ImageCursors::Initialize() {
70 if (!cursor_loader_)
71 cursor_loader_.reset(CursorLoader::Create());
72 }
73
68 float ImageCursors::GetScale() const { 74 float ImageCursors::GetScale() const {
69 if (!cursor_loader_) { 75 if (!cursor_loader_) {
70 NOTREACHED(); 76 NOTREACHED();
71 // Returning default on release build as it's not serious enough to crash 77 // Returning default on release build as it's not serious enough to crash
72 // even if this ever happens. 78 // even if this ever happens.
73 return 1.0f; 79 return 1.0f;
74 } 80 }
75 return cursor_loader_->scale(); 81 return cursor_loader_->scale();
76 } 82 }
77 83
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 cursor_size_ = cursor_size; 141 cursor_size_ = cursor_size;
136 142
137 if (cursor_loader_.get()) 143 if (cursor_loader_.get())
138 ReloadCursors(); 144 ReloadCursors();
139 } 145 }
140 146
141 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { 147 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) {
142 cursor_loader_->SetPlatformCursor(cursor); 148 cursor_loader_->SetPlatformCursor(cursor);
143 } 149 }
144 150
151 base::WeakPtr<ImageCursors> ImageCursors::GetWeakPtr() {
152 return weak_ptr_factory_.GetWeakPtr();
153 }
154
145 } // namespace ui 155 } // namespace ui
OLDNEW
« 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