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

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

Issue 1256613002: Add tracing for GL texture objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser_process_id
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | cc/resources/resource_provider.cc » ('j') | cc/resources/resource_provider.cc » ('J')
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 <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "base/trace_event/memory_dump_provider.h"
20 #include "cc/base/cc_export.h" 21 #include "cc/base/cc_export.h"
21 #include "cc/base/resource_id.h" 22 #include "cc/base/resource_id.h"
22 #include "cc/output/context_provider.h" 23 #include "cc/output/context_provider.h"
23 #include "cc/output/output_surface.h" 24 #include "cc/output/output_surface.h"
24 #include "cc/resources/release_callback_impl.h" 25 #include "cc/resources/release_callback_impl.h"
25 #include "cc/resources/resource_format.h" 26 #include "cc/resources/resource_format.h"
26 #include "cc/resources/return_callback.h" 27 #include "cc/resources/return_callback.h"
27 #include "cc/resources/shared_bitmap.h" 28 #include "cc/resources/shared_bitmap.h"
28 #include "cc/resources/single_release_callback_impl.h" 29 #include "cc/resources/single_release_callback_impl.h"
29 #include "cc/resources/texture_mailbox.h" 30 #include "cc/resources/texture_mailbox.h"
(...skipping 20 matching lines...) Expand all
50 } 51 }
51 52
52 namespace cc { 53 namespace cc {
53 class BlockingTaskRunner; 54 class BlockingTaskRunner;
54 class IdAllocator; 55 class IdAllocator;
55 class SharedBitmap; 56 class SharedBitmap;
56 class SharedBitmapManager; 57 class SharedBitmapManager;
57 58
58 // This class is not thread-safe and can only be called from the thread it was 59 // This class is not thread-safe and can only be called from the thread it was
59 // created on (in practice, the impl thread). 60 // created on (in practice, the impl thread).
60 class CC_EXPORT ResourceProvider { 61 class CC_EXPORT ResourceProvider
62 : public base::trace_event::MemoryDumpProvider {
61 private: 63 private:
62 struct Resource; 64 struct Resource;
63 65
64 public: 66 public:
65 typedef std::vector<ResourceId> ResourceIdArray; 67 typedef std::vector<ResourceId> ResourceIdArray;
66 typedef base::hash_set<ResourceId> ResourceIdSet; 68 typedef base::hash_set<ResourceId> ResourceIdSet;
67 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 69 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
68 enum TextureHint { 70 enum TextureHint {
69 TEXTURE_HINT_DEFAULT = 0x0, 71 TEXTURE_HINT_DEFAULT = 0x0,
70 TEXTURE_HINT_IMMUTABLE = 0x1, 72 TEXTURE_HINT_IMMUTABLE = 0x1,
71 TEXTURE_HINT_FRAMEBUFFER = 0x2, 73 TEXTURE_HINT_FRAMEBUFFER = 0x2,
72 TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER = 74 TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER =
73 TEXTURE_HINT_IMMUTABLE | TEXTURE_HINT_FRAMEBUFFER 75 TEXTURE_HINT_IMMUTABLE | TEXTURE_HINT_FRAMEBUFFER
74 }; 76 };
75 enum ResourceType { 77 enum ResourceType {
76 RESOURCE_TYPE_GL_TEXTURE, 78 RESOURCE_TYPE_GL_TEXTURE,
77 RESOURCE_TYPE_BITMAP, 79 RESOURCE_TYPE_BITMAP,
78 }; 80 };
79 81
80 static scoped_ptr<ResourceProvider> Create( 82 static scoped_ptr<ResourceProvider> Create(
81 OutputSurface* output_surface, 83 OutputSurface* output_surface,
82 SharedBitmapManager* shared_bitmap_manager, 84 SharedBitmapManager* shared_bitmap_manager,
83 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 85 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
84 BlockingTaskRunner* blocking_main_thread_task_runner, 86 BlockingTaskRunner* blocking_main_thread_task_runner,
85 int highp_threshold_min, 87 int highp_threshold_min,
86 bool use_rgba_4444_texture_format, 88 bool use_rgba_4444_texture_format,
87 size_t id_allocation_chunk_size, 89 size_t id_allocation_chunk_size,
88 bool use_persistent_map_for_gpu_memory_buffers); 90 bool use_persistent_map_for_gpu_memory_buffers);
89 virtual ~ResourceProvider(); 91 ~ResourceProvider() override;
90 92
91 void DidLoseOutputSurface() { lost_output_surface_ = true; } 93 void DidLoseOutputSurface() { lost_output_surface_ = true; }
92 94
93 int max_texture_size() const { return max_texture_size_; } 95 int max_texture_size() const { return max_texture_size_; }
94 ResourceFormat memory_efficient_texture_format() const { 96 ResourceFormat memory_efficient_texture_format() const {
95 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; 97 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_;
96 } 98 }
97 ResourceFormat best_texture_format() const { return best_texture_format_; } 99 ResourceFormat best_texture_format() const { return best_texture_format_; }
98 ResourceFormat best_render_buffer_format() const { 100 ResourceFormat best_render_buffer_format() const {
99 return best_render_buffer_format_; 101 return best_render_buffer_format_;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 void WaitSyncPointIfNeeded(ResourceId id); 432 void WaitSyncPointIfNeeded(ResourceId id);
431 433
432 void WaitReadLockIfNeeded(ResourceId id); 434 void WaitReadLockIfNeeded(ResourceId id);
433 435
434 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); 436 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl);
435 437
436 OutputSurface* output_surface() { return output_surface_; } 438 OutputSurface* output_surface() { return output_surface_; }
437 439
438 void ValidateResource(ResourceId id) const; 440 void ValidateResource(ResourceId id) const;
439 441
442 // base::trace_event::MemoryDumpProvider implementation.
443 bool OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) override;
444
440 protected: 445 protected:
441 ResourceProvider(OutputSurface* output_surface, 446 ResourceProvider(OutputSurface* output_surface,
442 SharedBitmapManager* shared_bitmap_manager, 447 SharedBitmapManager* shared_bitmap_manager,
443 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 448 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
444 BlockingTaskRunner* blocking_main_thread_task_runner, 449 BlockingTaskRunner* blocking_main_thread_task_runner,
445 int highp_threshold_min, 450 int highp_threshold_min,
446 bool use_rgba_4444_texture_format, 451 bool use_rgba_4444_texture_format,
447 size_t id_allocation_chunk_size, 452 size_t id_allocation_chunk_size,
448 bool use_persistent_map_for_gpu_memory_buffers); 453 bool use_persistent_map_for_gpu_memory_buffers);
449 void Initialize(); 454 void Initialize();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return format_gl_data_format[format]; 663 return format_gl_data_format[format];
659 } 664 }
660 665
661 inline GLenum GLInternalFormat(ResourceFormat format) { 666 inline GLenum GLInternalFormat(ResourceFormat format) {
662 return GLDataFormat(format); 667 return GLDataFormat(format);
663 } 668 }
664 669
665 } // namespace cc 670 } // namespace cc
666 671
667 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 672 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/resource_provider.cc » ('j') | cc/resources/resource_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698