Index: remoting/client/display/gl_cursor.cc |
diff --git a/remoting/client/display/gl_cursor.cc b/remoting/client/display/gl_cursor.cc |
index 4a4c55a1824ef50cd2cb5fd971ef1b4ba6271a49..dae30effbd1a971a958476718f86b757790c4e7d 100644 |
--- a/remoting/client/display/gl_cursor.cc |
+++ b/remoting/client/display/gl_cursor.cc |
@@ -18,7 +18,9 @@ namespace { |
const int kDefaultCursorDataSize = 32 * 32 * GlRenderLayer::kBytesPerPixel; |
} // namespace |
-GlCursor::GlCursor() {} |
+GlCursor::GlCursor() : weak_factory_(this) { |
+ SetZIndex(DrawableZIndex::CURSOR); |
+} |
GlCursor::~GlCursor() {} |
@@ -68,22 +70,24 @@ void GlCursor::SetCursorVisible(bool visible) { |
visible_ = visible; |
} |
-void GlCursor::SetCanvas(GlCanvas* canvas) { |
+void GlCursor::SetCanvas(base::WeakPtr<Canvas> canvas) { |
if (!canvas) { |
layer_.reset(); |
return; |
} |
- layer_.reset(new GlRenderLayer(kGlCursorTextureId, canvas)); |
+ layer_.reset(new GlRenderLayer(kGlCursorTextureId, canvas->GetWeakPtr())); |
Yuwei
2017/01/10 22:09:53
Just pass canvas. No need to call GetWeakPtr()
|
if (current_cursor_data_) { |
SetCurrentCursorShape(true); |
} |
SetCursorPosition(cursor_x_, cursor_y_); |
} |
-void GlCursor::Draw() { |
+bool GlCursor::Draw() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
if (layer_ && current_cursor_data_ && visible_) { |
layer_->Draw(1.f); |
} |
+ return false; |
} |
void GlCursor::SetCurrentCursorShape(bool size_changed) { |
@@ -98,4 +102,9 @@ void GlCursor::SetCurrentCursorShape(bool size_changed) { |
} |
} |
+base::WeakPtr<Drawable> GlCursor::GetWeakPtr() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ return weak_factory_.GetWeakPtr(); |
+} |
+ |
} // namespace remoting |