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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 93773002: Refactor SingleThreadProxy to reduce the call invocation for LayerTreeHost::contents_texture_manage… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch after formatting. Created 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index ee6d2fd3cfbdf117b3b2015708636d12b996578e..755467a8ec98605ca13557e723448ffab5a01ba5 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -200,9 +200,9 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
layer_tree_host_impl_->BeginCommit();
- if (layer_tree_host_->contents_texture_manager()) {
- layer_tree_host_->contents_texture_manager()->
- PushTexturePrioritiesToBackings();
+ if (PrioritizedResourceManager* contents_texture_manager =
+ layer_tree_host_->contents_texture_manager()) {
+ contents_texture_manager->PushTexturePrioritiesToBackings();
}
layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get());
@@ -329,24 +329,28 @@ bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread(
size_t limit_bytes,
int priority_cutoff) {
DCHECK(IsImplThread());
- if (!layer_tree_host_->contents_texture_manager())
- return false;
- if (!layer_tree_host_impl_->resource_provider())
+ PrioritizedResourceManager* contents_texture_manager =
+ layer_tree_host_->contents_texture_manager();
+
+ ResourceProvider* resource_provider =
+ layer_tree_host_impl_->resource_provider();
+
+ if (!contents_texture_manager || !resource_provider)
return false;
- return layer_tree_host_->contents_texture_manager()->ReduceMemoryOnImplThread(
- limit_bytes, priority_cutoff, layer_tree_host_impl_->resource_provider());
+ return contents_texture_manager->ReduceMemoryOnImplThread(
+ limit_bytes, priority_cutoff, resource_provider);
}
void SingleThreadProxy::SendManagedMemoryStats() {
DCHECK(Proxy::IsImplThread());
if (!layer_tree_host_impl_)
return;
- if (!layer_tree_host_->contents_texture_manager())
- return;
-
PrioritizedResourceManager* contents_texture_manager =
layer_tree_host_->contents_texture_manager();
+ if (!contents_texture_manager)
+ return;
+
layer_tree_host_impl_->SendManagedMemoryStats(
contents_texture_manager->MemoryVisibleBytes(),
contents_texture_manager->MemoryVisibleAndNearbyBytes(),
@@ -434,12 +438,12 @@ bool SingleThreadProxy::CommitAndComposite(
layer_tree_host_->AnimateLayers(frame_begin_time);
- if (layer_tree_host_->contents_texture_manager()) {
- layer_tree_host_->contents_texture_manager()
- ->UnlinkAndClearEvictedBackings();
- layer_tree_host_->contents_texture_manager()->SetMaxMemoryLimitBytes(
+ if (PrioritizedResourceManager* contents_texture_manager =
+ layer_tree_host_->contents_texture_manager()) {
+ contents_texture_manager->UnlinkAndClearEvictedBackings();
+ contents_texture_manager->SetMaxMemoryLimitBytes(
layer_tree_host_impl_->memory_allocation_limit_bytes());
- layer_tree_host_->contents_texture_manager()->SetExternalPriorityCutoff(
+ contents_texture_manager->SetExternalPriorityCutoff(
layer_tree_host_impl_->memory_allocation_priority_cutoff());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698