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

Unified Diff: android_webview/browser/surfaces_instance.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/surfaces_instance.h ('k') | blimp/client/core/compositor/blimp_compositor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/surfaces_instance.cc
diff --git a/android_webview/browser/surfaces_instance.cc b/android_webview/browser/surfaces_instance.cc
index 8f99bb22c6b184a0cfb724a271b014cc26d3a5f3..82d1ea51b432114f80f961af8cd8b39b9af8190d 100644
--- a/android_webview/browser/surfaces_instance.cc
+++ b/android_webview/browser/surfaces_instance.cc
@@ -38,7 +38,8 @@ scoped_refptr<SurfacesInstance> SurfacesInstance::GetOrCreateInstance() {
return make_scoped_refptr(new SurfacesInstance);
}
-SurfacesInstance::SurfacesInstance() : next_frame_sink_id_(1u) {
+SurfacesInstance::SurfacesInstance()
+ : next_client_id_(1u), frame_sink_id_(AllocateFrameSinkId()) {
cc::RendererSettings settings;
// Should be kept in sync with compositor_impl_android.cc.
@@ -49,9 +50,8 @@ SurfacesInstance::SurfacesInstance() : next_frame_sink_id_(1u) {
settings.should_clear_root_render_pass = false;
surface_manager_.reset(new cc::SurfaceManager);
- surface_id_allocator_.reset(new cc::SurfaceIdAllocator(
- cc::FrameSinkId(next_frame_sink_id_++, 0 /* frame_sink_id */)));
- surface_manager_->RegisterFrameSinkId(surface_id_allocator_->frame_sink_id());
+ surface_id_allocator_.reset(new cc::SurfaceIdAllocator(frame_sink_id_));
+ surface_manager_->RegisterFrameSinkId(frame_sink_id_);
std::unique_ptr<cc::BeginFrameSource> begin_frame_source(
new cc::StubBeginFrameSource);
@@ -70,11 +70,11 @@ SurfacesInstance::SurfacesInstance() : next_frame_sink_id_(1u) {
nullptr /* gpu_memory_buffer_manager */, settings,
std::move(begin_frame_source), std::move(output_surface_holder),
std::move(scheduler), std::move(texture_mailbox_deleter)));
- display_->Initialize(this, surface_manager_.get(),
- surface_id_allocator_->frame_sink_id());
+ display_->Initialize(this, surface_manager_.get(), frame_sink_id_);
display_->SetVisible(true);
- surface_factory_.reset(new cc::SurfaceFactory(surface_manager_.get(), this));
+ surface_factory_.reset(
+ new cc::SurfaceFactory(frame_sink_id_, surface_manager_.get(), this));
DCHECK(!g_surfaces_instance);
g_surfaces_instance = this;
@@ -89,12 +89,11 @@ SurfacesInstance::~SurfacesInstance() {
if (!root_id_.is_null())
surface_factory_->Destroy(root_id_);
- surface_manager_->InvalidateFrameSinkId(
- surface_id_allocator_->frame_sink_id());
+ surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
}
cc::FrameSinkId SurfacesInstance::AllocateFrameSinkId() {
- return cc::FrameSinkId(next_frame_sink_id_++, 0 /* sink_id */);
+ return cc::FrameSinkId(next_client_id_++, 0 /* sink_id */);
}
cc::SurfaceManager* SurfacesInstance::GetSurfaceManager() {
« no previous file with comments | « android_webview/browser/surfaces_instance.h ('k') | blimp/client/core/compositor/blimp_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698