forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardware_renderer.h
95 lines (71 loc) · 2.94 KB
/
hardware_renderer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_
#define ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_
#include <memory>
#include "android_webview/browser/render_thread_manager.h"
#include "base/macros.h"
#include "cc/surfaces/display_client.h"
#include "cc/surfaces/surface_factory_client.h"
#include "cc/surfaces/surface_id.h"
struct AwDrawGLInfo;
namespace cc {
class Display;
class SurfaceFactory;
class SurfaceIdAllocator;
class SurfaceManager;
}
namespace android_webview {
class AwGLSurface;
class ChildFrame;
class ParentOutputSurface;
class ScopedAppGLStateRestore;
class HardwareRenderer : public cc::DisplayClient,
public cc::SurfaceFactoryClient {
public:
explicit HardwareRenderer(RenderThreadManager* state);
~HardwareRenderer() override;
void DrawGL(AwDrawGLInfo* draw_info, const ScopedAppGLStateRestore& gl_state);
void CommitFrame();
void SetBackingFrameBufferObject(int framebuffer_binding_ext);
private:
// cc::DisplayClient overrides.
void OutputSurfaceLost() override {}
void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override {}
// cc::SurfaceFactoryClient implementation.
void ReturnResources(const cc::ReturnedResourceArray& resources) override;
void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
void ReturnResourcesInChildFrame();
void ReturnResourcesToCompositor(const cc::ReturnedResourceArray& resources,
uint32_t compositor_routing_id,
uint32_t output_surface_id);
RenderThreadManager* render_thread_manager_;
typedef void* EGLContext;
EGLContext last_egl_context_;
// Information about last delegated frame.
gfx::Size frame_size_;
// Infromation from UI on last commit.
gfx::Vector2d scroll_offset_;
// This holds the last ChildFrame received. Contains the frame info of the
// last frame. The |frame| member may be null if it's already submitted to
// SurfaceFactory.
std::unique_ptr<ChildFrame> child_frame_;
scoped_refptr<AwGLSurface> gl_surface_;
std::unique_ptr<cc::SurfaceManager> surface_manager_;
std::unique_ptr<cc::Display> display_;
std::unique_ptr<cc::SurfaceFactory> surface_factory_;
std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
cc::SurfaceId child_id_;
cc::SurfaceId root_id_;
uint32_t compositor_id_;
// HardwareRenderer guarantees resources are returned in the order of
// output_surface_id, and resources for old output surfaces are dropped.
uint32_t last_committed_output_surface_id_;
uint32_t last_submitted_output_surface_id_;
// This is owned by |display_|.
ParentOutputSurface* output_surface_;
DISALLOW_COPY_AND_ASSIGN(HardwareRenderer);
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_HARDWARE_RENDERER_H_