| OLD | NEW |
| 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_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
| 7 | 7 |
| 8 #include "android_webview/browser/browser_view_renderer_impl.h" | 8 #include "android_webview/browser/browser_view_renderer_impl.h" |
| 9 | 9 |
| 10 #include "content/public/renderer/android/synchronous_compositor_client.h" | 10 #include "content/public/renderer/android/synchronous_compositor_client.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class SynchronousCompositor; | 13 class SynchronousCompositor; |
| 14 class WebContents; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace android_webview { | 17 namespace android_webview { |
| 17 | 18 |
| 18 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 19 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
| 19 // IPC messages to the renderer and from there to WebKit. | 20 // IPC messages to the renderer and from there to WebKit. |
| 20 class InProcessViewRenderer : public BrowserViewRendererImpl, | 21 class InProcessViewRenderer : public BrowserViewRenderer, |
| 21 public content::SynchronousCompositorClient { | 22 public content::SynchronousCompositorClient { |
| 22 public: | 23 public: |
| 23 InProcessViewRenderer(BrowserViewRenderer::Client* client, | 24 InProcessViewRenderer(BrowserViewRenderer::Client* client, |
| 24 JavaHelper* java_helper); | 25 JavaHelper* java_helper); |
| 25 virtual ~InProcessViewRenderer(); | 26 virtual ~InProcessViewRenderer(); |
| 26 | 27 |
| 28 static InProcessViewRenderer* FromWebContents( |
| 29 content::WebContents* contents); |
| 30 static InProcessViewRenderer* FromId( |
| 31 int render_process_id, int render_view_id); |
| 32 void BindSynchronousCompositor( |
| 33 content::SynchronousCompositor* compositor); |
| 34 |
| 27 // BrowserViewRenderer overrides | 35 // BrowserViewRenderer overrides |
| 28 virtual void BindSynchronousCompositor( | 36 virtual void SetContents( |
| 29 content::SynchronousCompositor* compositor) OVERRIDE; | 37 content::ContentViewCore* content_view_core) OVERRIDE; |
| 30 virtual bool RenderPicture(SkCanvas* canvas) OVERRIDE; | 38 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; |
| 39 virtual void SetScrollForHWFrame(int x, int y) OVERRIDE; |
| 40 virtual bool DrawSW(jobject java_canvas, |
| 41 const gfx::Rect& clip_bounds) OVERRIDE; |
| 42 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; |
| 43 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; |
| 44 virtual void OnVisibilityChanged( |
| 45 bool view_visible, bool window_visible) OVERRIDE; |
| 46 virtual void OnSizeChanged(int width, int height) OVERRIDE; |
| 47 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; |
| 48 virtual void OnDetachedFromWindow() OVERRIDE; |
| 49 virtual bool IsAttachedToWindow() OVERRIDE; |
| 50 virtual bool IsViewVisible() OVERRIDE; |
| 51 virtual gfx::Rect GetScreenRect() OVERRIDE; |
| 31 | 52 |
| 32 // SynchronousCompositorClient overrides | 53 // SynchronousCompositorClient overrides |
| 33 virtual void DidDestroyCompositor( | 54 virtual void DidDestroyCompositor( |
| 34 content::SynchronousCompositor* compositor) OVERRIDE; | 55 content::SynchronousCompositor* compositor) OVERRIDE; |
| 56 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; |
| 57 |
| 58 void WebContentsGone(); |
| 35 | 59 |
| 36 private: | 60 private: |
| 61 void Invalidate(); |
| 62 bool RenderPicture(SkCanvas* canvas); |
| 63 |
| 64 content::WebContents* web_contents_; |
| 37 content::SynchronousCompositor* compositor_; | 65 content::SynchronousCompositor* compositor_; |
| 66 BrowserViewRenderer::Client* client_; |
| 67 |
| 68 bool view_visible_; |
| 69 |
| 70 // Set while inside DrawGL right before vsync so that we do not unnecessarily |
| 71 // trigger invalidates. |
| 72 bool inside_draw_; |
| 73 |
| 74 // When true, we should continuously invalidate and keep drawing, for example |
| 75 // to drive animation. |
| 76 bool continuous_invalidate_; |
| 77 |
| 78 // Used only for detecting Android View System context changes. |
| 79 // Not to be used between draw calls. |
| 80 EGLContext last_frame_context_; |
| 81 |
| 82 // Last View scroll before hardware rendering is triggered. |
| 83 gfx::Point hw_rendering_scroll_; |
| 38 | 84 |
| 39 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); | 85 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); |
| 40 }; | 86 }; |
| 41 | 87 |
| 42 } // namespace android_webview | 88 } // namespace android_webview |
| 43 | 89 |
| 44 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 90 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
| OLD | NEW |