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