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 AwDrawGLInfo
* draw_info
);
39 void SetBackingFrameBufferObject(int framebuffer_binding_ext
);
42 // cc::DisplayClient overrides.
43 void CommitVSyncParameters(base::TimeTicks timebase
,
44 base::TimeDelta interval
) override
{}
45 void OutputSurfaceLost() override
{}
46 void SetMemoryPolicy(const cc::ManagedMemoryPolicy
& policy
) override
{}
48 // cc::SurfaceFactoryClient implementation.
49 void ReturnResources(const cc::ReturnedResourceArray
& resources
) override
;
51 SharedRendererState
* shared_renderer_state_
;
53 typedef void* EGLContext
;
54 EGLContext last_egl_context_
;
56 // Information about last delegated frame.
57 gfx::Size frame_size_
;
59 // Infromation from UI on last commit.
60 gfx::Vector2d scroll_offset_
;
62 scoped_ptr
<ChildFrame
> child_frame_
;
64 scoped_refptr
<AwGLSurface
> gl_surface_
;
66 scoped_ptr
<cc::SurfaceManager
> surface_manager_
;
67 scoped_ptr
<cc::Display
> display_
;
68 scoped_ptr
<cc::SurfaceFactory
> surface_factory_
;
69 scoped_ptr
<cc::SurfaceIdAllocator
> surface_id_allocator_
;
70 cc::SurfaceId child_id_
;
71 cc::SurfaceId root_id_
;
73 // This is owned by |display_|.
74 ParentOutputSurface
* output_surface_
;
76 DISALLOW_COPY_AND_ASSIGN(HardwareRenderer
);
79 } // namespace android_webview
81 #endif // ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_