Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_CLIENT_RENDERER_FACADE_PROXY_H_ | |
| 6 #define REMOTING_CLIENT_RENDERER_FACADE_PROXY_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "base/single_thread_task_runner.h" | |
| 11 #include "remoting/client/renderer_facade.h" | |
| 12 | |
| 13 namespace remoting { | |
| 14 | |
| 15 class QueuedTaskPoster; | |
| 16 | |
| 17 // A class to proxy calls to a RendererFacade from one thread to another. | |
| 18 // TODO(yuweih): This should be removed once we have moved Drawables out of | |
| 19 // GlRenderer. | |
| 20 class RendererFacadeProxy : public RendererFacade { | |
|
nicholss
2017/05/15 15:49:40
I am not sure I understand the benefit to having b
Yuwei
2017/05/15 18:38:29
I could like to have a proxy that simply wraps the
| |
| 21 public: | |
| 22 // stub: The render stub being wrapped. | |
| 23 // task_runner: The task runner that |stub| should be run on. | |
| 24 RendererFacadeProxy(base::WeakPtr<RendererFacade> renderer, | |
| 25 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | |
| 26 ~RendererFacadeProxy() override; | |
| 27 | |
| 28 // RendererFacade overrides. | |
| 29 void SetTransformation(const ViewMatrix& transformation) override; | |
| 30 void SetCursorPosition(float x, float y) override; | |
| 31 void SetCursorVisibility(bool visible) override; | |
| 32 void StartInputFeedback(float x, float y, float diameter) override; | |
| 33 | |
| 34 private: | |
| 35 // Runs the |task| on the thread of |task_runner_|. All tasks run with | |
| 36 // |needs_synchronization| set to true inside the same tick will be run on | |
| 37 // |task_runner_| within the same tick. | |
| 38 void RunTaskOnProperThread(const base::Closure& task, | |
| 39 bool needs_synchronization); | |
| 40 | |
| 41 base::WeakPtr<RendererFacade> renderer_; | |
| 42 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 43 std::unique_ptr<remoting::QueuedTaskPoster> ui_task_poster_; | |
| 44 | |
| 45 // RenderStubProxy is neither copyable nor movable. | |
| 46 RendererFacadeProxy(const RendererFacadeProxy&) = delete; | |
| 47 RendererFacadeProxy& operator=(const RendererFacadeProxy&) = delete; | |
| 48 }; | |
| 49 | |
| 50 } // namespace remoting | |
| 51 #endif // REMOTING_CLIENT_RENDERER_FACADE_PROXY_H_ | |
| OLD | NEW |