Chromium Code Reviews| Index: android_webview/browser/test/fake_window.h |
| diff --git a/android_webview/browser/test/fake_window.h b/android_webview/browser/test/fake_window.h |
| index 5302f60a9c03b8bb3d09d0acb34a99b6014b383f..7e8dd9c0cac1d4ea3570bd52f56570dd227979d7 100644 |
| --- a/android_webview/browser/test/fake_window.h |
| +++ b/android_webview/browser/test/fake_window.h |
| @@ -7,6 +7,7 @@ |
| #include <map> |
| +#include "android_webview/browser/render_thread_manager_client.h" |
| #include "android_webview/public/browser/draw_gl.h" |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| @@ -24,6 +25,9 @@ class WaitableEvent; |
| namespace android_webview { |
| class BrowserViewRenderer; |
| +class CompositorFrameConsumer; |
| +class FakeFunctor; |
| +class RenderThreadManager; |
| class WindowHooks { |
| public: |
| @@ -31,6 +35,7 @@ class WindowHooks { |
| virtual void WillOnDraw() = 0; |
| virtual void DidOnDraw(bool success) = 0; |
| + virtual FakeFunctor* GetFunctorForView(BrowserViewRenderer* view) = 0; |
|
boliu
2016/05/13 16:09:02
nothing uses the parameter afaict, or maybe the ne
|
| virtual void WillSyncOnRT() = 0; |
| virtual void DidSyncOnRT() = 0; |
| @@ -42,21 +47,18 @@ class WindowHooks { |
| class FakeWindow { |
| public: |
| - using DrawGLCallback = base::Callback<void(AwDrawGLInfo*)>; |
| - |
| - FakeWindow(BrowserViewRenderer* view, |
| - const DrawGLCallback& draw_gl, |
| - WindowHooks* hooks, |
| - gfx::Rect location); |
| + FakeWindow(BrowserViewRenderer* view, WindowHooks* hooks, gfx::Rect location); |
| ~FakeWindow(); |
| void Detach(); |
| - // BrowserViewRendererClient methods. |
| - void RequestInvokeGL(bool wait_for_completion); |
| + void RequestInvokeGL(FakeFunctor* functor, bool wait_for_completion); |
| void PostInvalidate(); |
| const gfx::Size& surface_size() { return surface_size_; } |
| + void SetDrawFunctor(FakeFunctor* functor); |
| + void RequestDrawGL(FakeFunctor* functor); |
| + |
| private: |
| class ScopedMakeCurrent; |
| @@ -66,8 +68,10 @@ class FakeWindow { |
| void InitializeOnRT(base::WaitableEvent* sync); |
| void DestroyOnRT(base::WaitableEvent* sync); |
| - void ProcessFunctorOnRT(base::WaitableEvent* sync); |
| - void DrawFunctorOnRT(base::WaitableEvent* sync); |
| + void InvokeFunctorOnRT(FakeFunctor* functor, base::WaitableEvent* sync); |
| + void ProcessSyncOnRT(FakeFunctor* functor, base::WaitableEvent* sync); |
| + void ProcessDrawOnRT(FakeFunctor* functor); |
| + void DrawFunctorOnRT(FakeFunctor* functor, base::WaitableEvent* sync); |
| void CheckCurrentlyOnRT(); |
| // const so can be used on both threads. |
| @@ -83,17 +87,46 @@ class FakeWindow { |
| // Render thread members. |
| std::unique_ptr<base::Thread> render_thread_; |
| base::SequenceChecker rt_checker_; |
| - DrawGLCallback draw_gl_; |
| scoped_refptr<base::SingleThreadTaskRunner> render_thread_loop_; |
| scoped_refptr<gfx::GLSurface> surface_; |
| scoped_refptr<gfx::GLContext> context_; |
| bool context_current_; |
| + FakeFunctor* functor_; |
| base::WeakPtrFactory<FakeWindow> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(FakeWindow); |
| }; |
| +class FakeFunctor : public RenderThreadManagerClient { |
| + public: |
| + using DrawGLCallback = base::Callback<void(AwDrawGLInfo*)>; |
| + using RenderThreadManagerFactory = |
|
boliu
2016/05/13 16:09:02
remove
Tobias Sargeant
2016/05/13 17:02:37
Done.
|
| + base::Callback<RenderThreadManager*(RenderThreadManagerClient*)>; |
| + |
| + FakeFunctor(); |
| + ~FakeFunctor() override; |
| + |
| + CompositorFrameConsumer* GetCompositorFrameConsumer(); |
| + void Init(FakeWindow* window, |
|
boliu
2016/05/13 16:09:02
nit: Move Init up
Tobias Sargeant
2016/05/13 17:02:37
Done.
|
| + std::unique_ptr<RenderThreadManager> render_thread_manager); |
| + void Sync(const gfx::Rect& location, |
| + base::WaitableEvent* sync, |
| + WindowHooks* hooks); |
| + void Draw(WindowHooks* hooks); |
| + void Invoke(base::WaitableEvent* sync, WindowHooks* hooks); |
| + |
| + // RenderThreadManagerClient overrides |
| + bool RequestInvokeGL(bool wait_for_completion) override; |
| + void DetachFunctorFromView() override; |
| + |
| + private: |
| + FakeWindow* window_; |
| + DrawGLCallback callback_; |
| + std::unique_ptr<RenderThreadManager> render_thread_manager_; |
| + gfx::Rect committed_location_; |
| +}; |
| + |
| } // namespace android_webview |
| #endif // ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ |