Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/sequence_checker.h" | 13 #include "base/sequence_checker.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gl/gl_context.h" | 16 #include "ui/gl/gl_context.h" |
| 17 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class Thread; | 20 class Thread; |
| 21 class WaitableEvent; | 21 class WaitableEvent; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace android_webview { | 24 namespace android_webview { |
| 25 | 25 |
| 26 class BrowserViewRenderer; | 26 class BrowserViewRenderer; |
| 27 class RenderThreadManager; | |
| 28 | 27 |
| 29 class WindowHooks { | 28 class WindowHooks { |
| 30 public: | 29 public: |
| 31 virtual ~WindowHooks() {} | 30 virtual ~WindowHooks() {} |
| 32 | 31 |
| 33 virtual void WillOnDraw() = 0; | 32 virtual void WillOnDraw() = 0; |
| 34 virtual void DidOnDraw(bool success) = 0; | 33 virtual void DidOnDraw(bool success) = 0; |
| 35 | 34 |
| 36 virtual void WillSyncOnRT(RenderThreadManager* functor) = 0; | 35 virtual void WillSyncOnRT() = 0; |
| 37 virtual void DidSyncOnRT(RenderThreadManager* functor) = 0; | 36 virtual void DidSyncOnRT() = 0; |
| 38 virtual void WillProcessOnRT(RenderThreadManager* functor) = 0; | 37 virtual void WillProcessOnRT() = 0; |
| 39 virtual void DidProcessOnRT(RenderThreadManager* functor) = 0; | 38 virtual void DidProcessOnRT() = 0; |
| 40 virtual bool WillDrawOnRT(RenderThreadManager* functor, | 39 virtual bool WillDrawOnRT(AwDrawGLInfo* draw_info) = 0; |
| 41 AwDrawGLInfo* draw_info) = 0; | 40 virtual void DidDrawOnRT() = 0; |
| 42 virtual void DidDrawOnRT(RenderThreadManager* functor) = 0; | |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 class FakeWindow { | 43 class FakeWindow { |
| 46 public: | 44 public: |
| 45 typedef base::Callback<void(AwDrawGLInfo*)> DrawGLCallback; | |
|
boliu
2016/04/25 19:56:54
c++11 style is preferred now I think, using foo =
Tobias Sargeant
2016/04/26 15:29:52
Done. I didn't know that this existed. Thanks for
| |
| 46 | |
| 47 FakeWindow(BrowserViewRenderer* view, | 47 FakeWindow(BrowserViewRenderer* view, |
| 48 RenderThreadManager* functor, | 48 const base::Callback<void(AwDrawGLInfo*)> draw_gl, |
| 49 WindowHooks* hooks, | 49 WindowHooks* hooks, |
| 50 gfx::Rect location); | 50 gfx::Rect location); |
| 51 ~FakeWindow(); | 51 ~FakeWindow(); |
| 52 | 52 |
| 53 void Detach(); | 53 void Detach(); |
| 54 | 54 |
| 55 // BrowserViewRendererClient methods. | 55 // BrowserViewRendererClient methods. |
| 56 void RequestInvokeGL(bool wait_for_completion); | 56 void RequestInvokeGL(bool wait_for_completion); |
| 57 void PostInvalidate(); | 57 void PostInvalidate(); |
| 58 const gfx::Size& surface_size() { return surface_size_; } | 58 const gfx::Size& surface_size() { return surface_size_; } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 76 const gfx::Size surface_size_; | 76 const gfx::Size surface_size_; |
| 77 | 77 |
| 78 // UI thread members. | 78 // UI thread members. |
| 79 gfx::Rect location_; | 79 gfx::Rect location_; |
| 80 bool on_draw_hardware_pending_; | 80 bool on_draw_hardware_pending_; |
| 81 base::SequenceChecker ui_checker_; | 81 base::SequenceChecker ui_checker_; |
| 82 | 82 |
| 83 // Render thread members. | 83 // Render thread members. |
| 84 std::unique_ptr<base::Thread> render_thread_; | 84 std::unique_ptr<base::Thread> render_thread_; |
| 85 base::SequenceChecker rt_checker_; | 85 base::SequenceChecker rt_checker_; |
| 86 RenderThreadManager* functor_; | 86 DrawGLCallback draw_gl_; |
| 87 scoped_refptr<base::SingleThreadTaskRunner> render_thread_loop_; | 87 scoped_refptr<base::SingleThreadTaskRunner> render_thread_loop_; |
| 88 scoped_refptr<gfx::GLSurface> surface_; | 88 scoped_refptr<gfx::GLSurface> surface_; |
| 89 scoped_refptr<gfx::GLContext> context_; | 89 scoped_refptr<gfx::GLContext> context_; |
| 90 bool context_current_; | 90 bool context_current_; |
| 91 | 91 |
| 92 base::WeakPtrFactory<FakeWindow> weak_ptr_factory_; | 92 base::WeakPtrFactory<FakeWindow> weak_ptr_factory_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(FakeWindow); | 94 DISALLOW_COPY_AND_ASSIGN(FakeWindow); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace android_webview | 97 } // namespace android_webview |
| 98 | 98 |
| 99 #endif // ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ | 99 #endif // ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ |
| OLD | NEW |