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

Unified Diff: remoting/client/display/gl_cursor.cc

Issue 2591363002: Adding drawable to CRD andorid and iOS gl rendering pipeline. (Closed)
Patch Set: Finished next round of feedback changes. Added more weakptrs for canvas passing. Created 3 years, 11 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
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

Powered by Google App Engine
This is Rietveld 408576698