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

Unified Diff: android_webview/browser/hardware_renderer.cc

Issue 2383373002: Reduce SurfaceIdAllocator usage and tie SurfaceFactory to a single FrameSinkId (Closed)
Patch Set: Rebased Created 4 years, 2 months 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/surfaces_instance.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 b951f94e0891262c2406aff2bbbf3d3cef6bceaf..56b9e008b26eee3dd6dc7baad8b2117f24b12de6 100644
--- a/android_webview/browser/hardware_renderer.cc
+++ b/android_webview/browser/hardware_renderer.cc
@@ -13,6 +13,7 @@
#include "android_webview/browser/render_thread_manager.h"
#include "android_webview/browser/surfaces_instance.h"
#include "android_webview/public/browser/draw_gl.h"
+#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h"
#include "cc/output/compositor_frame.h"
#include "cc/surfaces/surface_factory.h"
@@ -27,15 +28,15 @@ HardwareRenderer::HardwareRenderer(RenderThreadManager* state)
: render_thread_manager_(state),
last_egl_context_(eglGetCurrentContext()),
surfaces_(SurfacesInstance::GetOrCreateInstance()),
+ frame_sink_id_(surfaces_->AllocateFrameSinkId()),
surface_id_allocator_(
- new cc::SurfaceIdAllocator(surfaces_->AllocateFrameSinkId())),
+ base::MakeUnique<cc::SurfaceIdAllocator>(frame_sink_id_)),
last_committed_compositor_frame_sink_id_(0u),
last_submitted_compositor_frame_sink_id_(0u) {
DCHECK(last_egl_context_);
- surfaces_->GetSurfaceManager()->RegisterFrameSinkId(
- surface_id_allocator_->frame_sink_id());
- surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient(
- surface_id_allocator_->frame_sink_id(), this);
+ surfaces_->GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
+ surfaces_->GetSurfaceManager()->RegisterSurfaceFactoryClient(frame_sink_id_,
+ this);
}
HardwareRenderer::~HardwareRenderer() {
@@ -45,9 +46,8 @@ HardwareRenderer::~HardwareRenderer() {
DestroySurface();
surface_factory_.reset();
surfaces_->GetSurfaceManager()->UnregisterSurfaceFactoryClient(
- surface_id_allocator_->frame_sink_id());
- surfaces_->GetSurfaceManager()->InvalidateFrameSinkId(
- surface_id_allocator_->frame_sink_id());
+ frame_sink_id_);
+ surfaces_->GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_);
// Reset draw constraints.
render_thread_manager_->PostExternalDrawConstraintsToChildCompositorOnRT(
@@ -99,8 +99,8 @@ void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info) {
compositor_id_ = child_frame_->compositor_id;
last_submitted_compositor_frame_sink_id_ =
child_frame_->compositor_frame_sink_id;
- surface_factory_.reset(
- new cc::SurfaceFactory(surfaces_->GetSurfaceManager(), this));
+ surface_factory_.reset(new cc::SurfaceFactory(
+ frame_sink_id_, surfaces_->GetSurfaceManager(), this));
}
std::unique_ptr<cc::CompositorFrame> child_compositor_frame =
« no previous file with comments | « android_webview/browser/hardware_renderer.h ('k') | android_webview/browser/surfaces_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698