Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1579)

Unified Diff: android_webview/browser/test/fake_window.h

Issue 1943963003: WIP Handle AwContents needing multiple live functors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from PS17 Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/render_thread_manager.cc ('k') | android_webview/browser/test/fake_window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..603d5531b1069ee22ed4c39ec8c07e59221d8fb0 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* GetFunctor() = 0;
virtual void WillSyncOnRT() = 0;
virtual void DidSyncOnRT() = 0;
@@ -42,21 +47,17 @@ 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 RequestDrawGL(FakeFunctor* functor);
+
private:
class ScopedMakeCurrent;
@@ -66,8 +67,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,7 +86,6 @@ 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_;
@@ -94,6 +96,32 @@ class FakeWindow {
DISALLOW_COPY_AND_ASSIGN(FakeWindow);
};
+class FakeFunctor : public RenderThreadManagerClient {
+ public:
+ using DrawGLCallback = base::Callback<void(AwDrawGLInfo*)>;
+
+ FakeFunctor();
+ ~FakeFunctor() override;
+
+ void Init(FakeWindow* window,
+ std::unique_ptr<RenderThreadManager> render_thread_manager);
+ void Sync(const gfx::Rect& location, WindowHooks* hooks);
+ void Draw(WindowHooks* hooks);
+ void Invoke(WindowHooks* hooks);
+
+ CompositorFrameConsumer* GetCompositorFrameConsumer();
+
+ // 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_
« no previous file with comments | « android_webview/browser/render_thread_manager.cc ('k') | android_webview/browser/test/fake_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698