1 // Copyright 2014 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.
5 #ifndef ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_
6 #define ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_
8 #include "android_webview/browser/shared_renderer_state.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/surfaces/display_client.h"
11 #include "cc/surfaces/surface_factory_client.h"
12 #include "cc/surfaces/surface_id.h"
19 class SurfaceIdAllocator
;
23 namespace android_webview
{
27 class ParentOutputSurface
;
29 class HardwareRenderer
: public cc::DisplayClient
,
30 public cc::SurfaceFactoryClient
{
32 explicit HardwareRenderer(SharedRendererState
* state
);
33 ~HardwareRenderer() override
;
35 void DrawGL(bool stencil_enabled
,
36 int framebuffer_binding_ext
,
37 AwDrawGLInfo
* draw_info
);
41 // cc::DisplayClient overrides.
42 void CommitVSyncParameters(base::TimeTicks timebase
,
43 base::TimeDelta interval
) override
{}
44 void OutputSurfaceLost() override
{}
45 void SetMemoryPolicy(const cc::ManagedMemoryPolicy
& policy
) override
{}
47 // cc::SurfaceFactoryClient implementation.
48 void ReturnResources(const cc::ReturnedResourceArray
& resources
) override
;
50 SharedRendererState
* shared_renderer_state_
;
52 typedef void* EGLContext
;
53 EGLContext last_egl_context_
;
55 // Information about last delegated frame.
56 gfx::Size frame_size_
;
58 // Infromation from UI on last commit.
59 gfx::Vector2d scroll_offset_
;
61 scoped_ptr
<ChildFrame
> child_frame_
;
63 scoped_refptr
<AwGLSurface
> gl_surface_
;
65 scoped_ptr
<cc::SurfaceManager
> surface_manager_
;
66 scoped_ptr
<cc::Display
> display_
;
67 scoped_ptr
<cc::SurfaceFactory
> surface_factory_
;
68 scoped_ptr
<cc::SurfaceIdAllocator
> surface_id_allocator_
;
69 cc::SurfaceId child_id_
;
70 cc::SurfaceId root_id_
;
72 // This is owned by |display_|.
73 ParentOutputSurface
* output_surface_
;
75 DISALLOW_COPY_AND_ASSIGN(HardwareRenderer
);
78 } // namespace android_webview
80 #endif // ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_