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

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

Issue 2440093003: WIP GPU scheduler + delayed activation / tile draw
Patch Set: SignalSyncToken -> IsFenceSyncReleased Created 4 years 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
« no previous file with comments | « cc/raster/zero_copy_raster_buffer_provider.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PROVIDER_H_ 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_
6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <memory> 12 #include <memory>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <unordered_map> 15 #include <unordered_map>
16 #include <unordered_set> 16 #include <unordered_set>
17 #include <utility> 17 #include <utility>
18 #include <vector> 18 #include <vector>
19 19
20 #include "base/callback.h" 20 #include "base/callback.h"
21 #include "base/cancelable_callback.h"
21 #include "base/macros.h" 22 #include "base/macros.h"
22 #include "base/memory/linked_ptr.h" 23 #include "base/memory/linked_ptr.h"
23 #include "base/threading/thread_checker.h" 24 #include "base/threading/thread_checker.h"
24 #include "base/trace_event/memory_allocator_dump.h" 25 #include "base/trace_event/memory_allocator_dump.h"
25 #include "base/trace_event/memory_dump_provider.h" 26 #include "base/trace_event/memory_dump_provider.h"
26 #include "cc/base/cc_export.h" 27 #include "cc/base/cc_export.h"
27 #include "cc/base/resource_id.h" 28 #include "cc/base/resource_id.h"
28 #include "cc/output/context_provider.h" 29 #include "cc/output/context_provider.h"
29 #include "cc/output/output_surface.h" 30 #include "cc/output/output_surface.h"
30 #include "cc/output/renderer_settings.h" 31 #include "cc/output/renderer_settings.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Update pixels from image, copying source_rect (in image) to dest_offset (in 156 // Update pixels from image, copying source_rect (in image) to dest_offset (in
156 // the resource). 157 // the resource).
157 void CopyToResource(ResourceId id, 158 void CopyToResource(ResourceId id,
158 const uint8_t* image, 159 const uint8_t* image,
159 const gfx::Size& image_size); 160 const gfx::Size& image_size);
160 161
161 // Generates sync tokesn for resources which need a sync token. 162 // Generates sync tokesn for resources which need a sync token.
162 void GenerateSyncTokenForResource(ResourceId resource_id); 163 void GenerateSyncTokenForResource(ResourceId resource_id);
163 void GenerateSyncTokenForResources(const ResourceIdArray& resource_ids); 164 void GenerateSyncTokenForResources(const ResourceIdArray& resource_ids);
164 165
166 gpu::SyncToken GetSyncTokenForResource(ResourceId resource_id);
167 gpu::SyncToken GetSyncTokenForResources(const ResourceIdArray& resource_ids);
168
165 // Creates accounting for a child. Returns a child ID. 169 // Creates accounting for a child. Returns a child ID.
166 int CreateChild(const ReturnCallback& return_callback); 170 int CreateChild(const ReturnCallback& return_callback);
167 171
168 // Destroys accounting for the child, deleting all accounted resources. 172 // Destroys accounting for the child, deleting all accounted resources.
169 void DestroyChild(int child); 173 void DestroyChild(int child);
170 174
171 // Sets whether resources need sync points set on them when returned to this 175 // Sets whether resources need sync points set on them when returned to this
172 // child. Defaults to true. 176 // child. Defaults to true.
173 void SetChildNeedsSyncTokens(int child, bool needs_sync_tokens); 177 void SetChildNeedsSyncTokens(int child, bool needs_sync_tokens);
174 178
(...skipping 10 matching lines...) Expand all
185 // Receives resources from a child, moving them from mailboxes. Resource IDs 189 // Receives resources from a child, moving them from mailboxes. Resource IDs
186 // passed are in the child namespace, and will be translated to the parent 190 // passed are in the child namespace, and will be translated to the parent
187 // namespace, added to the child->parent map. 191 // namespace, added to the child->parent map.
188 // This adds the resources to the working set in the ResourceProvider without 192 // This adds the resources to the working set in the ResourceProvider without
189 // declaring which resources are in use. Use DeclareUsedResourcesFromChild 193 // declaring which resources are in use. Use DeclareUsedResourcesFromChild
190 // after calling this method to do that. All calls to ReceiveFromChild should 194 // after calling this method to do that. All calls to ReceiveFromChild should
191 // be followed by a DeclareUsedResourcesFromChild. 195 // be followed by a DeclareUsedResourcesFromChild.
192 // NOTE: if the sync_token is set on any TransferableResource, this will 196 // NOTE: if the sync_token is set on any TransferableResource, this will
193 // wait on it. 197 // wait on it.
194 void ReceiveFromChild( 198 void ReceiveFromChild(
195 int child, const TransferableResourceArray& transferable_resources); 199 int child,
200 const TransferableResourceArray& transferable_resources);
196 201
197 // Once a set of resources have been received, they may or may not be used. 202 // Once a set of resources have been received, they may or may not be used.
198 // This declares what set of resources are currently in use from the child, 203 // This declares what set of resources are currently in use from the child,
199 // releasing any other resources back to the child. 204 // releasing any other resources back to the child.
200 void DeclareUsedResourcesFromChild(int child, 205 void DeclareUsedResourcesFromChild(int child,
201 const ResourceIdSet& resources_from_child); 206 const ResourceIdSet& resources_from_child);
202 207
203 // Receives resources from the parent, moving them from mailboxes. Resource 208 // Receives resources from the parent, moving them from mailboxes. Resource
204 // IDs passed are in the child namespace. 209 // IDs passed are in the child namespace.
205 // NOTE: if the sync_token is set on any TransferableResource, this will 210 // NOTE: if the sync_token is set on any TransferableResource, this will
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 ~ScopedWriteLockGL(); 271 ~ScopedWriteLockGL();
267 272
268 unsigned texture_id() const { return texture_id_; } 273 unsigned texture_id() const { return texture_id_; }
269 GLenum target() const { return target_; } 274 GLenum target() const { return target_; }
270 ResourceFormat format() const { return format_; } 275 ResourceFormat format() const { return format_; }
271 const gfx::Size& size() const { return size_; } 276 const gfx::Size& size() const { return size_; }
272 sk_sp<SkColorSpace> sk_color_space() const { return sk_color_space_; } 277 sk_sp<SkColorSpace> sk_color_space() const { return sk_color_space_; }
273 278
274 const TextureMailbox& mailbox() const { return mailbox_; } 279 const TextureMailbox& mailbox() const { return mailbox_; }
275 280
281 const gpu::SyncToken& sync_token() const { return sync_token_; }
282
276 void set_sync_token(const gpu::SyncToken& sync_token) { 283 void set_sync_token(const gpu::SyncToken& sync_token) {
277 sync_token_ = sync_token; 284 sync_token_ = sync_token;
278 has_sync_token_ = true; 285 has_sync_token_ = true;
279 } 286 }
280 287
281 void set_synchronized(bool synchronized) { synchronized_ = synchronized; } 288 void set_synchronized(bool synchronized) { synchronized_ = synchronized; }
282 289
283 private: 290 private:
284 ResourceProvider* resource_provider_; 291 ResourceProvider* resource_provider_;
285 ResourceId resource_id_; 292 ResourceId resource_id_;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 std::unique_ptr<IdAllocator> texture_id_allocator_; 712 std::unique_ptr<IdAllocator> texture_id_allocator_;
706 std::unique_ptr<IdAllocator> buffer_id_allocator_; 713 std::unique_ptr<IdAllocator> buffer_id_allocator_;
707 714
708 bool use_sync_query_; 715 bool use_sync_query_;
709 BufferToTextureTargetMap buffer_to_texture_target_map_; 716 BufferToTextureTargetMap buffer_to_texture_target_map_;
710 717
711 // A process-unique ID used for disambiguating memory dumps from different 718 // A process-unique ID used for disambiguating memory dumps from different
712 // resource providers. 719 // resource providers.
713 int tracing_id_; 720 int tracing_id_;
714 721
722 base::WeakPtrFactory<ResourceProvider> weak_ptr_factory_;
723
715 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 724 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
716 }; 725 };
717 726
718 } // namespace cc 727 } // namespace cc
719 728
720 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 729 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/raster/zero_copy_raster_buffer_provider.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698