Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Unified Diff: android_webview/browser/hardware_renderer.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/hardware_renderer.h ('k') | android_webview/browser/render_thread_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/hardware_renderer.cc
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc
index 391534203dfd68d4ba41527c3b4c8bc62fe09f48..8befffea009eba39186cf896c24cb6d70273ea75 100644
--- a/android_webview/browser/hardware_renderer.cc
+++ b/android_webview/browser/hardware_renderer.cc
@@ -30,6 +30,9 @@ HardwareRenderer::HardwareRenderer(RenderThreadManager* state)
surfaces_(SurfacesInstance::GetOrCreateInstance()),
frame_sink_id_(surfaces_->AllocateFrameSinkId()),
surface_id_allocator_(base::MakeUnique<cc::SurfaceIdAllocator>()),
+ surface_factory_(new cc::SurfaceFactory(frame_sink_id_,
+ surfaces_->GetSurfaceManager(),
+ this)),
last_committed_compositor_frame_sink_id_(0u),
last_submitted_compositor_frame_sink_id_(0u) {
DCHECK(last_egl_context_);
@@ -62,30 +65,14 @@ void HardwareRenderer::CommitFrame() {
if (!child_frame.get())
return;
ReturnResourcesInChildFrame();
- frame_future_ = render_thread_manager_->PassFrameFutureOnRT();
child_frame_ = std::move(child_frame);
}
void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info) {
TRACE_EVENT0("android_webview", "HardwareRenderer::DrawGL");
- if (frame_future_) {
- TRACE_EVENT0("android_webview", "GetFrame");
- DCHECK(child_frame_);
- DCHECK(!child_frame_->frame);
-
- std::unique_ptr<content::SynchronousCompositor::Frame> frame =
- frame_future_->GetFrame();
- if (frame) {
- child_frame_->compositor_frame_sink_id = frame->compositor_frame_sink_id;
- child_frame_->frame = std::move(frame->frame);
- } else {
- child_frame_.reset();
- }
- frame_future_ = nullptr;
- }
-
if (child_frame_) {
+ child_frame_->WaitOnFutureIfNeeded();
last_committed_compositor_frame_sink_id_ =
child_frame_->compositor_frame_sink_id;
}
@@ -111,12 +98,10 @@ void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info) {
DestroySurface();
// This will return all the resources to the previous compositor.
- surface_factory_.reset();
+ surface_factory_->Reset();
compositor_id_ = child_frame_->compositor_id;
last_submitted_compositor_frame_sink_id_ =
child_frame_->compositor_frame_sink_id;
- surface_factory_.reset(new cc::SurfaceFactory(
- frame_sink_id_, surfaces_->GetSurfaceManager(), this));
}
std::unique_ptr<cc::CompositorFrame> child_compositor_frame =
@@ -164,7 +149,6 @@ void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info) {
void HardwareRenderer::AllocateSurface() {
DCHECK(child_id_.is_null());
- DCHECK(surface_factory_);
child_id_ = surface_id_allocator_->GenerateId();
surface_factory_->Create(child_id_);
surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_));
@@ -172,7 +156,6 @@ void HardwareRenderer::AllocateSurface() {
void HardwareRenderer::DestroySurface() {
DCHECK(!child_id_.is_null());
- DCHECK(surface_factory_);
// Submit an empty frame to force any existing resources to be returned.
surface_factory_->SubmitCompositorFrame(child_id_, cc::CompositorFrame(),
« no previous file with comments | « android_webview/browser/hardware_renderer.h ('k') | android_webview/browser/render_thread_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698