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

Side by Side Diff: cc/resources/resource_pool.h

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and add missing locks Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_RESOURCES_RESOURCE_POOL_H_ 5 #ifndef CC_RESOURCES_RESOURCE_POOL_H_
6 #define CC_RESOURCES_RESOURCE_POOL_H_ 6 #define CC_RESOURCES_RESOURCE_POOL_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 18 matching lines...) Expand all
29 ResourceFormat format); 29 ResourceFormat format);
30 scoped_ptr<ScopedResource> TryAcquireResourceWithContentId(uint64 content_id); 30 scoped_ptr<ScopedResource> TryAcquireResourceWithContentId(uint64 content_id);
31 void ReleaseResource(scoped_ptr<ScopedResource> resource, 31 void ReleaseResource(scoped_ptr<ScopedResource> resource,
32 uint64_t content_id); 32 uint64_t content_id);
33 33
34 void SetResourceUsageLimits(size_t max_memory_usage_bytes, 34 void SetResourceUsageLimits(size_t max_memory_usage_bytes,
35 size_t max_unused_memory_usage_bytes, 35 size_t max_unused_memory_usage_bytes,
36 size_t max_resource_count); 36 size_t max_resource_count);
37 37
38 void ReduceResourceUsage(); 38 void ReduceResourceUsage();
39 // This might block if |wait_if_needed| is true and one of the currently 39 void CheckBusyResources();
40 // busy resources has a read lock fence that needs to be waited upon before
41 // it can be locked for write again.
42 void CheckBusyResources(bool wait_if_needed);
43 40
44 size_t total_memory_usage_bytes() const { return memory_usage_bytes_; } 41 size_t total_memory_usage_bytes() const { return memory_usage_bytes_; }
45 size_t acquired_memory_usage_bytes() const { 42 size_t acquired_memory_usage_bytes() const {
46 return memory_usage_bytes_ - unused_memory_usage_bytes_; 43 return memory_usage_bytes_ - unused_memory_usage_bytes_;
47 } 44 }
48 size_t total_resource_count() const { return resource_count_; } 45 size_t total_resource_count() const { return resource_count_; }
49 size_t acquired_resource_count() const { 46 size_t acquired_resource_count() const {
50 return resource_count_ - unused_resources_.size(); 47 return resource_count_ - unused_resources_.size();
51 } 48 }
52 size_t busy_resource_count() const { return busy_resources_.size(); } 49 size_t busy_resource_count() const { return busy_resources_.size(); }
(...skipping 25 matching lines...) Expand all
78 typedef std::deque<PoolResource> ResourceList; 75 typedef std::deque<PoolResource> ResourceList;
79 ResourceList unused_resources_; 76 ResourceList unused_resources_;
80 ResourceList busy_resources_; 77 ResourceList busy_resources_;
81 78
82 DISALLOW_COPY_AND_ASSIGN(ResourcePool); 79 DISALLOW_COPY_AND_ASSIGN(ResourcePool);
83 }; 80 };
84 81
85 } // namespace cc 82 } // namespace cc
86 83
87 #endif // CC_RESOURCES_RESOURCE_POOL_H_ 84 #endif // CC_RESOURCES_RESOURCE_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698