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

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

Issue 12668003: Fix for crash in testWindows test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mutual deregistration Created 7 years, 9 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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_BROWSER_VIEW_RENDERER_IMPL_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_
6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_ 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_
7 7
8 #include "android_webview/browser/browser_view_renderer.h" 8 #include "android_webview/browser/browser_view_renderer.h"
9 #include "android_webview/browser/renderer_host/view_renderer_host.h" 9 #include "android_webview/browser/renderer_host/view_renderer_host.h"
10 #include "content/public/browser/android/compositor.h" 10 #include "content/public/browser/android/compositor.h"
(...skipping 20 matching lines...) Expand all
31 31
32 namespace android_webview { 32 namespace android_webview {
33 33
34 class BrowserViewRendererImpl 34 class BrowserViewRendererImpl
35 : public BrowserViewRenderer, 35 : public BrowserViewRenderer,
36 public ViewRendererHost::Client, 36 public ViewRendererHost::Client,
37 public content::Compositor::Client { 37 public content::Compositor::Client {
38 public: 38 public:
39 static BrowserViewRendererImpl* Create(BrowserViewRenderer::Client* client, 39 static BrowserViewRendererImpl* Create(BrowserViewRenderer::Client* client,
40 JavaHelper* java_helper); 40 JavaHelper* java_helper);
41 static BrowserViewRendererImpl* FromWebContents(
42 content::WebContents* contents);
43 static void SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table);
44
41 virtual ~BrowserViewRendererImpl(); 45 virtual ~BrowserViewRendererImpl();
42 46
43 // Platform methods.
44 static void SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table);
45
46 // BrowserViewRenderer implementation. 47 // BrowserViewRenderer implementation.
47 // |content_view_core| must not outlive |this| BrowserViewRenderer instance.
48 virtual void SetContents( 48 virtual void SetContents(
49 content::ContentViewCore* content_view_core) OVERRIDE; 49 content::ContentViewCore* content_view_core) OVERRIDE;
50 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; 50 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE;
51 virtual void SetScrollForHWFrame(int x, int y) OVERRIDE; 51 virtual void SetScrollForHWFrame(int x, int y) OVERRIDE;
52 virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip) OVERRIDE; 52 virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip) OVERRIDE;
53 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; 53 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE;
54 virtual void EnableOnNewPicture(OnNewPictureMode mode) OVERRIDE; 54 virtual void EnableOnNewPicture(OnNewPictureMode mode) OVERRIDE;
55 virtual void OnVisibilityChanged( 55 virtual void OnVisibilityChanged(
56 bool view_visible, bool window_visible) OVERRIDE; 56 bool view_visible, bool window_visible) OVERRIDE;
57 virtual void OnSizeChanged(int width, int height) OVERRIDE; 57 virtual void OnSizeChanged(int width, int height) OVERRIDE;
58 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; 58 virtual void OnAttachedToWindow(int width, int height) OVERRIDE;
59 virtual void OnDetachedFromWindow() OVERRIDE; 59 virtual void OnDetachedFromWindow() OVERRIDE;
60 60
61 // content::Compositor::Client implementation. 61 // content::Compositor::Client implementation.
62 virtual void ScheduleComposite() OVERRIDE; 62 virtual void ScheduleComposite() OVERRIDE;
63 63
64 // ViewRendererHost::Client implementation. 64 // ViewRendererHost::Client implementation.
65 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE; 65 virtual void OnPictureUpdated(int process_id, int render_view_id) OVERRIDE;
66 66
67 protected: 67 protected:
68 BrowserViewRendererImpl(BrowserViewRenderer::Client* client, 68 BrowserViewRendererImpl(BrowserViewRenderer::Client* client,
69 JavaHelper* java_helper); 69 JavaHelper* java_helper);
70 70
71 private: 71 private:
72 class UserData;
73 friend class UserData;
74
72 // Returns the latest locally available picture if any. 75 // Returns the latest locally available picture if any.
73 // If none is available will synchronously request the latest one 76 // If none is available will synchronously request the latest one
74 // and block until the result is received. 77 // and block until the result is received.
75 skia::RefPtr<SkPicture> GetLastCapturedPicture(); 78 skia::RefPtr<SkPicture> GetLastCapturedPicture();
76 void OnPictureUpdated(); 79 void OnPictureUpdated();
77 80
78 void SetCompositorVisibility(bool visible); 81 void SetCompositorVisibility(bool visible);
79 void ResetCompositor(); 82 void ResetCompositor();
80 void Invalidate(); 83 void Invalidate();
81 bool RenderSW(SkCanvas* canvas); 84 bool RenderSW(SkCanvas* canvas);
82 bool RenderPicture(SkCanvas* canvas); 85 bool RenderPicture(SkCanvas* canvas);
83 86
84 void OnFrameInfoUpdated(const gfx::SizeF& content_size, 87 void OnFrameInfoUpdated(const gfx::SizeF& content_size,
85 const gfx::Vector2dF& scroll_offset, 88 const gfx::Vector2dF& scroll_offset,
86 float page_scale_factor); 89 float page_scale_factor);
87 90
91 // Called when |web_contents_| is disconnected from |this| object.
92 void WebContentsGone();
93
88 BrowserViewRenderer::Client* client_; 94 BrowserViewRenderer::Client* client_;
89 BrowserViewRenderer::JavaHelper* java_helper_; 95 BrowserViewRenderer::JavaHelper* java_helper_;
90 96
91 scoped_ptr<ViewRendererHost> view_renderer_host_; 97 scoped_ptr<ViewRendererHost> view_renderer_host_;
92 scoped_ptr<content::Compositor> compositor_; 98 scoped_ptr<content::Compositor> compositor_;
93 99
94 // Ensures content keeps clipped within the view during transformations. 100 // Ensures content keeps clipped within the view during transformations.
95 scoped_refptr<cc::Layer> view_clip_layer_; 101 scoped_refptr<cc::Layer> view_clip_layer_;
96 102
97 // Applies the transformation matrix. 103 // Applies the transformation matrix.
(...skipping 24 matching lines...) Expand all
122 128
123 // Used to observe frame metadata updates. 129 // Used to observe frame metadata updates.
124 content::ContentViewCore::UpdateFrameInfoCallback update_frame_info_callback_; 130 content::ContentViewCore::UpdateFrameInfoCallback update_frame_info_callback_;
125 131
126 DISALLOW_COPY_AND_ASSIGN(BrowserViewRendererImpl); 132 DISALLOW_COPY_AND_ASSIGN(BrowserViewRendererImpl);
127 }; 133 };
128 134
129 } // namespace android_webview 135 } // namespace android_webview
130 136
131 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_ 137 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698