Chromium Code Reviews| Index: remoting/client/display/gl_desktop.h |
| diff --git a/remoting/client/display/gl_desktop.h b/remoting/client/display/gl_desktop.h |
| index d43247c52b11a429b34f3edb4c79cafc566aa2a1..504889c12d40fb53a003fd5cc060ac7b90867e8c 100644 |
| --- a/remoting/client/display/gl_desktop.h |
| +++ b/remoting/client/display/gl_desktop.h |
| @@ -9,6 +9,9 @@ |
| #include <vector> |
| #include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "remoting/client/display/drawable.h" |
| #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| namespace webrtc { |
| @@ -17,24 +20,21 @@ class DesktopFrame; |
| namespace remoting { |
| -class GlCanvas; |
| +class Canvas; |
| // This class draws the desktop on the canvas. |
| -class GlDesktop { |
| +class GlDesktop : public Drawable { |
| public: |
| GlDesktop(); |
| - virtual ~GlDesktop(); |
| + ~GlDesktop() override; |
| // |frame| can be either a full frame or updated regions only frame. |
| void SetVideoFrame(const webrtc::DesktopFrame& frame); |
| - // Sets the canvas on which the desktop will be drawn. Caller must feed a |
| - // full desktop frame after calling this function. |
| - // If |canvas| is nullptr, nothing will happen when calling Draw(). |
| - void SetCanvas(GlCanvas* canvas); |
| - |
| - // Draws the desktop on the canvas. |
| - void Draw(); |
| + // Drawable implementation |
|
joedow
2017/01/10 22:01:55
nit: Add period to end of comment.
|
| + void SetCanvas(base::WeakPtr<Canvas> canvas) override; |
| + bool Draw() override; |
| + base::WeakPtr<Drawable> GetWeakPtr() override; |
| private: |
| struct GlDesktopTextureContainer; |
| @@ -45,7 +45,9 @@ class GlDesktop { |
| webrtc::DesktopSize last_desktop_size_; |
| int max_texture_size_ = 0; |
| - GlCanvas* canvas_ = nullptr; |
| + base::WeakPtr<Canvas> canvas_ = nullptr; |
| + base::ThreadChecker thread_checker_; |
| + base::WeakPtrFactory<Drawable> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(GlDesktop); |
| }; |