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 "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 11 #include "base/sequence_checker.h" | 12 #include "base/sequence_checker.h" |
| 12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gl/gl_context.h" | 15 #include "ui/gl/gl_context.h" |
| 15 #include "ui/gl/gl_surface.h" | 16 #include "ui/gl/gl_surface.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class Thread; | 19 class Thread; |
| 19 class WaitableEvent; | 20 class WaitableEvent; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace android_webview { | 23 namespace android_webview { |
| 23 | 24 |
| 24 class BrowserViewRenderer; | 25 class BrowserViewRenderer; |
| 25 class SharedRendererState; | 26 class SharedRendererState; |
| 26 | 27 |
| 27 class WindowHooks { | 28 class WindowHooks { |
| 28 public: | 29 public: |
| 29 virtual ~WindowHooks() {} | 30 virtual ~WindowHooks() {} |
| 30 | 31 |
| 31 virtual void WillOnDraw() = 0; | 32 virtual void WillOnDraw() = 0; |
| 32 virtual void DidOnDraw(bool success) = 0; | 33 virtual void DidOnDraw(bool success) = 0; |
| 33 | 34 |
| 34 virtual void WillSyncOnRT(SharedRendererState* functor) = 0; | 35 virtual void WillSyncOnRT(SharedRendererState* functor) = 0; |
| 35 virtual void DidSyncOnRT(SharedRendererState* functor) = 0; | 36 virtual void DidSyncOnRT(SharedRendererState* functor) = 0; |
| 36 virtual void WillProcessOnRT(SharedRendererState* functor) = 0; | 37 virtual void WillProcessOnRT(SharedRendererState* functor) = 0; |
| 37 virtual void DidProcessOnRT(SharedRendererState* functor) = 0; | 38 virtual void DidProcessOnRT(SharedRendererState* functor) = 0; |
| 38 virtual void WillDrawOnRT(SharedRendererState* functor) = 0; | 39 virtual void SetParentDrawConstraints(AwDrawGLInfo& draw_info) = 0; |
|
boliu
2015/03/13 23:51:55
I'd much rather have SetSurfaceRect, SetTransform
hush (inactive)
2015/03/16 18:19:21
Putting it into fake window make it hard for the r
boliu
2015/03/16 20:25:08
Merge it into WillDrawOnRT?
hush (inactive)
2015/03/17 18:26:45
Done.
| |
| 40 virtual bool WillDrawOnRT(SharedRendererState* functor) = 0; | |
| 39 virtual void DidDrawOnRT(SharedRendererState* functor) = 0; | 41 virtual void DidDrawOnRT(SharedRendererState* functor) = 0; |
| 42 virtual bool WillWaitForModeDrawToFinish() = 0; | |
|
boliu
2015/03/13 23:51:55
This can be a setter too.
hush (inactive)
2015/03/16 18:19:21
This bool will be read by both RT and UI in the ne
boliu
2015/03/16 20:25:08
Ok for now I guess.
The other option is make the
hush (inactive)
2015/03/17 18:26:45
I just removed this flag..
| |
| 40 }; | 43 }; |
| 41 | 44 |
| 42 class FakeWindow { | 45 class FakeWindow { |
| 43 public: | 46 public: |
| 44 FakeWindow(BrowserViewRenderer* view, | 47 FakeWindow(BrowserViewRenderer* view, |
| 45 WindowHooks* hooks, | 48 WindowHooks* hooks, |
| 46 gfx::Rect location); | 49 gfx::Rect location); |
| 47 ~FakeWindow(); | 50 ~FakeWindow(); |
| 48 | 51 |
| 49 void Detach(); | 52 void Detach(); |
| 50 | 53 |
| 51 // BrowserViewRendererClient methods. | 54 // BrowserViewRendererClient methods. |
| 52 void RequestDrawGL(bool wait_for_completion); | 55 void RequestDrawGL(bool wait_for_completion); |
| 53 void PostInvalidate(); | 56 void PostInvalidate(); |
| 57 const gfx::Size& surface_size() { return surface_size_; } | |
| 54 | 58 |
| 55 private: | 59 private: |
| 56 class ScopedMakeCurrent; | 60 class ScopedMakeCurrent; |
| 57 | 61 |
| 58 void OnDrawHardware(); | 62 void OnDrawHardware(); |
| 59 void CheckCurrentlyOnUIThread(); | 63 void CheckCurrentlyOnUIThread(); |
| 60 void CreateRenderThreadIfNeeded(); | 64 void CreateRenderThreadIfNeeded(); |
| 61 | 65 |
| 62 void InitializeOnRT(base::WaitableEvent* sync); | 66 void InitializeOnRT(base::WaitableEvent* sync); |
| 63 void DestroyOnRT(base::WaitableEvent* sync); | 67 void DestroyOnRT(base::WaitableEvent* sync); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 85 bool context_current_; | 89 bool context_current_; |
| 86 | 90 |
| 87 base::WeakPtrFactory<FakeWindow> weak_ptr_factory_; | 91 base::WeakPtrFactory<FakeWindow> weak_ptr_factory_; |
| 88 | 92 |
| 89 DISALLOW_COPY_AND_ASSIGN(FakeWindow); | 93 DISALLOW_COPY_AND_ASSIGN(FakeWindow); |
| 90 }; | 94 }; |
| 91 | 95 |
| 92 } // namespace android_webview | 96 } // namespace android_webview |
| 93 | 97 |
| 94 #endif // ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ | 98 #endif // ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ |
| OLD | NEW |