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

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

Issue 142863008: Revert of [#7] Pass gfx structs by const ref (gfx::Size) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 | « cc/resources/picture_pile_base.cc ('k') | cc/resources/prioritized_resource.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_PRIORITIZED_RESOURCE_H_ 5 #ifndef CC_RESOURCES_PRIORITIZED_RESOURCE_H_
6 #define CC_RESOURCES_PRIORITIZED_RESOURCE_H_ 6 #define CC_RESOURCES_PRIORITIZED_RESOURCE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 #include "cc/resources/priority_calculator.h" 12 #include "cc/resources/priority_calculator.h"
13 #include "cc/resources/resource.h" 13 #include "cc/resources/resource.h"
14 #include "cc/resources/resource_provider.h" 14 #include "cc/resources/resource_provider.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 #include "ui/gfx/vector2d.h" 17 #include "ui/gfx/vector2d.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 class PrioritizedResourceManager; 21 class PrioritizedResourceManager;
22 class Proxy; 22 class Proxy;
23 23
24 class CC_EXPORT PrioritizedResource { 24 class CC_EXPORT PrioritizedResource {
25 public: 25 public:
26 static scoped_ptr<PrioritizedResource> Create( 26 static scoped_ptr<PrioritizedResource> Create(
27 PrioritizedResourceManager* manager, 27 PrioritizedResourceManager* manager,
28 const gfx::Size& size, 28 gfx::Size size,
29 ResourceFormat format) { 29 ResourceFormat format) {
30 return make_scoped_ptr(new PrioritizedResource(manager, size, format)); 30 return make_scoped_ptr(new PrioritizedResource(manager, size, format));
31 } 31 }
32 static scoped_ptr<PrioritizedResource> Create( 32 static scoped_ptr<PrioritizedResource> Create(
33 PrioritizedResourceManager* manager) { 33 PrioritizedResourceManager* manager) {
34 return make_scoped_ptr( 34 return make_scoped_ptr(
35 new PrioritizedResource(manager, gfx::Size(), RGBA_8888)); 35 new PrioritizedResource(manager, gfx::Size(), RGBA_8888));
36 } 36 }
37 ~PrioritizedResource(); 37 ~PrioritizedResource();
38 38
39 // Texture properties. Changing these causes the backing texture to be lost. 39 // Texture properties. Changing these causes the backing texture to be lost.
40 // Setting these to the same value is a no-op. 40 // Setting these to the same value is a no-op.
41 void SetTextureManager(PrioritizedResourceManager* manager); 41 void SetTextureManager(PrioritizedResourceManager* manager);
42 PrioritizedResourceManager* resource_manager() { return manager_; } 42 PrioritizedResourceManager* resource_manager() { return manager_; }
43 void SetDimensions(const gfx::Size& size, ResourceFormat format); 43 void SetDimensions(gfx::Size size, ResourceFormat format);
44 ResourceFormat format() const { return format_; } 44 ResourceFormat format() const { return format_; }
45 gfx::Size size() const { return size_; } 45 gfx::Size size() const { return size_; }
46 size_t bytes() const { return bytes_; } 46 size_t bytes() const { return bytes_; }
47 bool contents_swizzled() const { return contents_swizzled_; } 47 bool contents_swizzled() const { return contents_swizzled_; }
48 48
49 // Set priority for the requested texture. 49 // Set priority for the requested texture.
50 void set_request_priority(int priority) { priority_ = priority; } 50 void set_request_priority(int priority) { priority_ = priority; }
51 int request_priority() const { return priority_; } 51 int request_priority() const { return priority_; }
52 52
53 // After PrioritizedResource::PrioritizeTextures() is called, this returns 53 // After PrioritizedResource::PrioritizeTextures() is called, this returns
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void ReturnBackingTexture(); 100 void ReturnBackingTexture();
101 101
102 private: 102 private:
103 friend class PrioritizedResourceManager; 103 friend class PrioritizedResourceManager;
104 friend class PrioritizedResourceTest; 104 friend class PrioritizedResourceTest;
105 105
106 class Backing : public Resource { 106 class Backing : public Resource {
107 public: 107 public:
108 Backing(unsigned id, 108 Backing(unsigned id,
109 ResourceProvider* resource_provider, 109 ResourceProvider* resource_provider,
110 const gfx::Size& size, 110 gfx::Size size,
111 ResourceFormat format); 111 ResourceFormat format);
112 ~Backing(); 112 ~Backing();
113 void UpdatePriority(); 113 void UpdatePriority();
114 void UpdateState(ResourceProvider* resource_provider); 114 void UpdateState(ResourceProvider* resource_provider);
115 115
116 PrioritizedResource* owner() { return owner_; } 116 PrioritizedResource* owner() { return owner_; }
117 bool CanBeRecycledIfNotInExternalUse() const; 117 bool CanBeRecycledIfNotInExternalUse() const;
118 int request_priority_at_last_priority_update() const { 118 int request_priority_at_last_priority_update() const {
119 return priority_at_last_priority_update_; 119 return priority_at_last_priority_update_;
120 } 120 }
(...skipping 22 matching lines...) Expand all
143 143
144 bool resource_has_been_deleted_; 144 bool resource_has_been_deleted_;
145 145
146 #ifndef NDEBUG 146 #ifndef NDEBUG
147 ResourceProvider* resource_provider_; 147 ResourceProvider* resource_provider_;
148 #endif 148 #endif
149 DISALLOW_COPY_AND_ASSIGN(Backing); 149 DISALLOW_COPY_AND_ASSIGN(Backing);
150 }; 150 };
151 151
152 PrioritizedResource(PrioritizedResourceManager* resource_manager, 152 PrioritizedResource(PrioritizedResourceManager* resource_manager,
153 const gfx::Size& size, 153 gfx::Size size,
154 ResourceFormat format); 154 ResourceFormat format);
155 155
156 bool is_above_priority_cutoff() { return is_above_priority_cutoff_; } 156 bool is_above_priority_cutoff() { return is_above_priority_cutoff_; }
157 void set_above_priority_cutoff(bool is_above_priority_cutoff) { 157 void set_above_priority_cutoff(bool is_above_priority_cutoff) {
158 is_above_priority_cutoff_ = is_above_priority_cutoff; 158 is_above_priority_cutoff_ = is_above_priority_cutoff;
159 } 159 }
160 void set_manager_internal(PrioritizedResourceManager* manager) { 160 void set_manager_internal(PrioritizedResourceManager* manager) {
161 manager_ = manager; 161 manager_ = manager;
162 } 162 }
163 163
(...skipping 12 matching lines...) Expand all
176 176
177 Backing* backing_; 177 Backing* backing_;
178 PrioritizedResourceManager* manager_; 178 PrioritizedResourceManager* manager_;
179 179
180 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource); 180 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource);
181 }; 181 };
182 182
183 } // namespace cc 183 } // namespace cc
184 184
185 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_H_ 185 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_H_
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_base.cc ('k') | cc/resources/prioritized_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698