Chromium Code Reviews| Index: remoting/client/render_stub_proxy.h |
| diff --git a/remoting/client/render_stub_proxy.h b/remoting/client/render_stub_proxy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6686184527d3cded79235a19da3cc0a92d4f05a9 |
| --- /dev/null |
| +++ b/remoting/client/render_stub_proxy.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef REMOTING_CLIENT_RENDER_STUB_PROXY_H_ |
| +#define REMOTING_CLIENT_RENDER_STUB_PROXY_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/single_thread_task_runner.h" |
| +#include "remoting/client/render_stub.h" |
| + |
| +namespace remoting { |
| + |
| +class QueuedTaskPoster; |
| + |
| +// A class to proxy calls to a RenderStub from one thread to another. |
| +class RenderStubProxy : public RenderStub { |
| + public: |
| + // stub: The render stub being wrapped. |
| + // task_runner: The task runner that |stub| should be run on. |
| + RenderStubProxy(base::WeakPtr<RenderStub> stub, |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| + ~RenderStubProxy() override; |
| + |
| + // RenderStub overrides. |
| + void SetTransformation(const ViewMatrix& transformation) override; |
| + void SetCursorPosition(float x, float y) override; |
| + void SetCursorVisibility(bool visible) override; |
| + void StartInputFeedback(float x, float y, float diameter) override; |
| + |
| + private: |
| + void RunTaskOnProperThread(const base::Closure& task, |
|
nicholss
2017/05/12 21:42:40
This method is doing magic task things and I don't
Yuwei
2017/05/13 00:41:52
Done.
|
| + bool needs_synchronization); |
| + |
| + base::WeakPtr<RenderStub> stub_; |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| + std::unique_ptr<remoting::QueuedTaskPoster> ui_task_poster_; |
| + |
| + // RenderStubProxy is neither copyable nor movable. |
| + RenderStubProxy(const RenderStubProxy&) = delete; |
| + RenderStubProxy& operator=(const RenderStubProxy&) = delete; |
| +}; |
| + |
| +} // namespace remoting |
| +#endif // REMOTING_CLIENT_RENDER_STUB_PROXY_H_ |