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

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

Issue 12041009: [Android WebView] Migrate the rendering code to a separate set of classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated and rebased. Created 7 years, 10 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/web_contents_observer.h"
12 #include "ui/gfx/point.h"
13 #include "ui/gfx/size.h"
14
15 typedef void* EGLContext;
16 class SkCanvas;
17
18 namespace content {
19 class WebContents;
20 }
21
22 namespace android_webview {
23
24 class BrowserViewRendererImpl : public BrowserViewRenderer,
25 public ViewRendererHost::Client,
26 public content::Compositor::Client {
joth 2013/02/06 20:26:31 is this indenting style normal? Anyway, it's certa
Leandro GraciĆ” Gil 2013/02/07 12:43:56 It seems I got this bit from the WebKit-styled fil
27 public:
28 static BrowserViewRendererImpl* Create(BrowserViewRenderer::Client* client,
29 JavaHelper* java_helper);
30 virtual ~BrowserViewRendererImpl();
31
32 // BrowserViewRenderer implementation.
33 virtual void SetContents(
34 content::ContentViewCore* content_view_core) OVERRIDE;
35 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE;
36 virtual void SetScrollForHWFrame(int x, int y) OVERRIDE;
37 virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip) OVERRIDE;
38 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE;
39 virtual void EnableOnNewPicture(OnNewPictureMode mode) OVERRIDE;
40 virtual void OnVisibilityChanged(
41 bool view_visible, bool window_visible) OVERRIDE;
42 virtual void OnSizeChanged(int width, int height) OVERRIDE;
43 virtual void OnAttachedToWindow(int width, int height) OVERRIDE;
44 virtual void OnDetachedFromWindow() OVERRIDE;
45
46 // content::Compositor::Client implementation.
47 virtual void ScheduleComposite() OVERRIDE;
48
49 // ViewRendererHost::Client implementation.
50 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE;
51
52 protected:
53 BrowserViewRendererImpl(BrowserViewRenderer::Client* client,
54 JavaHelper* java_helper);
55
56 private:
57 // Returns the latest locally available picture if any.
58 // If none is available will synchronously request the latest one
59 // and block until the result is received.
60 skia::RefPtr<SkPicture> GetLastCapturedPicture();
61 void OnPictureUpdated();
62
63 void SetCompositorVisibility(bool visible);
64 void ResetCompositor();
65 void Invalidate();
66 bool RenderSW(SkCanvas* canvas);
67 bool RenderPicture(SkCanvas* canvas);
68
69 scoped_ptr<ViewRendererHost> view_renderer_host_;
70 scoped_ptr<content::Compositor> compositor_;
71
72 // Ensures content keeps clipped within the view during transformations.
73 scoped_refptr<cc::Layer> view_clip_layer_;
74
75 // Applies the transformation matrix.
76 scoped_refptr<cc::Layer> transform_layer_;
77
78 // Ensures content is drawn within the scissor clip rect provided by the
79 // Android framework.
80 scoped_refptr<cc::Layer> scissor_clip_layer_;
81
82 // Last View scroll before hardware rendering is triggered.
83 gfx::Point hw_rendering_scroll_;
84
85 bool view_visible_;
86 bool compositor_visible_;
87 bool is_composite_pending_;
88 float dpi_scale_;
89 gfx::Size view_size_;
90 OnNewPictureMode on_new_picture_mode_;
91
92 // Used only for detecting Android View System context changes.
93 // Not to be used between draw calls.
94 EGLContext last_frame_context_;
95
96 // Set via SetContents. Used to recognize updates to the local WebView.
97 content::WebContents* web_contents_;
98
99 DISALLOW_COPY_AND_ASSIGN(BrowserViewRendererImpl);
100 };
101
102 } // namespace android_webview
103
104 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698