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

Side by Side Diff: android_webview/browser/test/fake_view_root_impl.h

Issue 786533002: aw: Rendering test harness and end-to-end smoke test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no production Created 6 years 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <map>
6
7 #include "base/memory/weak_ptr.h"
8 #include "base/single_thread_task_runner.h"
9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gl/gl_context.h"
11 #include "ui/gl/gl_surface.h"
12
13 namespace base {
14 class Thread;
15 class WaitableEvent;
16 }
17
18 namespace android_webview {
19
20 class BrowserViewRenderer;
21 class SharedRendererState;
22
23 class ViewRootHooks {
24 public:
25 virtual ~ViewRootHooks() {}
26
27 virtual void WillOnDraw() = 0;
28 virtual void DidOnDraw() = 0;
29
30 virtual void WillSyncOnRT(SharedRendererState* functor) = 0;
31 virtual void DidSyncOnRT(SharedRendererState* functor) = 0;
32 virtual void WillProcessOnRT(SharedRendererState* functor) = 0;
33 virtual void DidProcessOnRT(SharedRendererState* functor) = 0;
34 virtual void WillDrawOnRT(SharedRendererState* functor) = 0;
35 virtual void DidDrawOnRT(SharedRendererState* functor) = 0;
36 };
37
38 class FakeViewRootImpl {
39 public:
40 FakeViewRootImpl(BrowserViewRenderer* view,
41 ViewRootHooks* hooks,
42 gfx::Rect location);
43 ~FakeViewRootImpl();
44
45 void Detach();
46
47 // BrowserViewRendererClient methods.
48 void RequestDrawGL(bool wait_for_completion);
49 void PostInvalidate();
50
51 private:
52 void OnDrawHardware();
53 void CheckRenderThread();
54
55 void InitializeOnRT(base::WaitableEvent* sync);
56 void DestroyOnRT(base::WaitableEvent* sync);
57 void ProcessFunctorOnRT(base::WaitableEvent* sync);
58 void DrawFunctorOnRT(base::WaitableEvent* sync);
59
60 class ScopedMakeCurrent;
61
62 // const so can be used on both threads.
63 BrowserViewRenderer* view_;
hush (inactive) 2014/12/10 20:07:58 so the following pointers need to be const?
boliu 2014/12/10 21:30:32 Umm, I think I can declare it "BVR* const view" or
64 ViewRootHooks* hooks_;
65 const gfx::Size surface_size_;
66
67 // UI on
68 gfx::Rect location_;
hush (inactive) 2014/12/10 20:07:58 how is the location a rect? You mean the view itse
boliu 2014/12/10 21:30:32 Yeah. This is supposed to be the viewrootimpl or
69 bool on_draw_hardware_pending_;
70
71 // Render thread members.
72 scoped_ptr<base::Thread> render_thread_;
73 SharedRendererState* functor_;
74 scoped_refptr<base::SingleThreadTaskRunner> render_thread_loop_;
75 scoped_refptr<gfx::GLSurface> surface_;
76 scoped_refptr<gfx::GLContext> context_;
77 bool context_current_;
78
79 base::WeakPtrFactory<FakeViewRootImpl> weak_ptr_factory_;
80
81 DISALLOW_COPY_AND_ASSIGN(FakeViewRootImpl);
82 };
83
84 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698