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

Side by Side Diff: android_webview/browser/browser_view_renderer_impl.h

Issue 16796002: Delete the browser-compositor webview render mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_
6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_
7
8 #include "android_webview/browser/browser_view_renderer.h"
9 #include "android_webview/browser/renderer_host/view_renderer_host.h"
10 #include "content/public/browser/android/compositor.h"
11 #include "content/public/browser/android/content_view_core.h"
12 #include "content/public/browser/web_contents_observer.h"
13 #include "skia/ext/refptr.h"
14 #include "ui/gfx/point.h"
15 #include "ui/gfx/size.h"
16 #include "ui/gfx/size_f.h"
17
18 typedef void* EGLContext;
19 struct AwDrawSWFunctionTable;
20 struct AwDrawGLInfo;
21 class SkCanvas;
22 class SkPicture;
23
24 namespace content {
25 class SynchronousCompositor;
26 class WebContents;
27 }
28
29 namespace gfx {
30 class Vector2dF;
31 }
32
33 namespace android_webview {
34
35 class BrowserViewRendererImpl
36 : public BrowserViewRenderer,
37 public ViewRendererHost::Client,
38 public content::Compositor::Client {
39 public:
40 static BrowserViewRenderer* Create(BrowserViewRenderer::Client* client,
41 JavaHelper* java_helper);
42 static BrowserViewRendererImpl* FromWebContents(
43 content::WebContents* contents);
44
45 virtual ~BrowserViewRendererImpl();
46
47 // BrowserViewRenderer implementation.
48 virtual void SetContents(
49 content::ContentViewCore* content_view_core) OVERRIDE;
50 virtual bool PrepareDrawGL(int x, int y) OVERRIDE;
51 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE;
52 virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip) OVERRIDE;
53 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE;
54 virtual void EnableOnNewPicture(bool enabled) OVERRIDE;
55 virtual void OnVisibilityChanged(
56 bool view_visible, bool window_visible) OVERRIDE;
57 virtual void OnSizeChanged(int width, int height) OVERRIDE;
58 virtual void OnAttachedToWindow(int width, int height) OVERRIDE;
59 virtual void OnDetachedFromWindow() OVERRIDE;
60 virtual bool IsAttachedToWindow() OVERRIDE;
61 virtual bool IsViewVisible() OVERRIDE;
62 virtual gfx::Rect GetScreenRect() OVERRIDE;
63
64 // content::Compositor::Client implementation.
65 virtual void ScheduleComposite() OVERRIDE;
66
67 // ViewRendererHost::Client implementation.
68 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE;
69
70 protected:
71 BrowserViewRendererImpl(BrowserViewRenderer::Client* client,
72 JavaHelper* java_helper);
73
74 virtual bool RenderPicture(SkCanvas* canvas);
75
76 private:
77 class UserData;
78 friend class UserData;
79
80 // Returns the latest locally available picture if any.
81 // If none is available will synchronously request the latest one
82 // and block until the result is received.
83 skia::RefPtr<SkPicture> GetLastCapturedPicture();
84 void OnPictureUpdated();
85
86 void SetCompositorVisibility(bool visible);
87 void ResetCompositor();
88 void Invalidate();
89 bool RenderSW(SkCanvas* canvas);
90
91 void OnFrameInfoUpdated(const gfx::SizeF& content_size,
92 const gfx::Vector2dF& scroll_offset,
93 float page_scale_factor);
94
95 // Called when |web_contents_| is disconnected from |this| object.
96 void WebContentsGone();
97
98 BrowserViewRenderer::Client* client_;
99 BrowserViewRenderer::JavaHelper* java_helper_;
100
101 scoped_ptr<ViewRendererHost> view_renderer_host_;
102 scoped_ptr<content::Compositor> compositor_;
103
104 // Ensures content keeps clipped within the view during transformations.
105 scoped_refptr<cc::Layer> view_clip_layer_;
106
107 // Applies the transformation matrix.
108 scoped_refptr<cc::Layer> transform_layer_;
109
110 // Ensures content is drawn within the scissor clip rect provided by the
111 // Android framework.
112 scoped_refptr<cc::Layer> scissor_clip_layer_;
113
114 // Last View scroll before hardware rendering is triggered.
115 gfx::Point hw_rendering_scroll_;
116
117 bool view_attached_;
118 bool view_visible_;
119 bool compositor_visible_;
120 bool is_composite_pending_;
121 float dpi_scale_;
122 float page_scale_;
123 gfx::Size view_size_;
124 gfx::SizeF content_size_css_;
125 bool new_picture_enabled_;
126
127 // Used only for detecting Android View System context changes.
128 // Not to be used between draw calls.
129 EGLContext last_frame_context_;
130
131 // Set via SetContents. Used to recognize updates to the local WebView.
132 content::WebContents* web_contents_;
133
134 // Used to observe frame metadata updates.
135 content::ContentViewCore::UpdateFrameInfoCallback update_frame_info_callback_;
136
137 bool prevent_client_invalidate_;
138
139 DISALLOW_COPY_AND_ASSIGN(BrowserViewRendererImpl);
140 };
141
142 } // namespace android_webview
143
144 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « android_webview/browser/aw_devtools_delegate.cc ('k') | android_webview/browser/browser_view_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698