OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 /////////////////////////////////////////////////////////////////////////////// | 116 /////////////////////////////////////////////////////////////////////////////// |
117 | 117 |
118 class GrResourceEntry { | 118 class GrResourceEntry { |
119 public: | 119 public: |
120 GrResource* resource() const { return fResource; } | 120 GrResource* resource() const { return fResource; } |
121 const GrResourceKey& key() const { return fKey; } | 121 const GrResourceKey& key() const { return fKey; } |
122 | 122 |
123 static const GrResourceKey& GetKey(const GrResourceEntry& e) { return e.key(
); } | 123 static const GrResourceKey& GetKey(const GrResourceEntry& e) { return e.key(
); } |
124 static uint32_t Hash(const GrResourceKey& key) { return key.getHash(); } | 124 static uint32_t Hash(const GrResourceKey& key) { return key.getHash(); } |
125 static bool Equal(const GrResourceEntry& a, const GrResourceKey& b) { | |
126 return a.key() == b; | |
127 } | |
128 #ifdef SK_DEBUG | 125 #ifdef SK_DEBUG |
129 void validate() const; | 126 void validate() const; |
130 #else | 127 #else |
131 void validate() const {} | 128 void validate() const {} |
132 #endif | 129 #endif |
133 | 130 |
134 private: | 131 private: |
135 GrResourceEntry(const GrResourceKey& key, GrResource* resource); | 132 GrResourceEntry(const GrResourceKey& key, GrResource* resource); |
136 ~GrResourceEntry(); | 133 ~GrResourceEntry(); |
137 | 134 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 }; | 311 }; |
315 | 312 |
316 void internalDetach(GrResourceEntry*, BudgetBehaviors behavior = kAccountFor
_BudgetBehavior); | 313 void internalDetach(GrResourceEntry*, BudgetBehaviors behavior = kAccountFor
_BudgetBehavior); |
317 void attachToHead(GrResourceEntry*, BudgetBehaviors behavior = kAccountFor_B
udgetBehavior); | 314 void attachToHead(GrResourceEntry*, BudgetBehaviors behavior = kAccountFor_B
udgetBehavior); |
318 | 315 |
319 void removeInvalidResource(GrResourceEntry* entry); | 316 void removeInvalidResource(GrResourceEntry* entry); |
320 | 317 |
321 GrTMultiMap<GrResourceEntry, | 318 GrTMultiMap<GrResourceEntry, |
322 GrResourceKey, | 319 GrResourceKey, |
323 GrResourceEntry::GetKey, | 320 GrResourceEntry::GetKey, |
324 GrResourceEntry::Hash, | 321 GrResourceEntry::Hash> fCache; |
325 GrResourceEntry::Equal> fCache; | |
326 | 322 |
327 // We're an internal doubly linked list | 323 // We're an internal doubly linked list |
328 typedef SkTInternalLList<GrResourceEntry> EntryList; | 324 typedef SkTInternalLList<GrResourceEntry> EntryList; |
329 EntryList fList; | 325 EntryList fList; |
330 | 326 |
331 #ifdef SK_DEBUG | 327 #ifdef SK_DEBUG |
332 // These objects cannot be returned by a search | 328 // These objects cannot be returned by a search |
333 EntryList fExclusiveList; | 329 EntryList fExclusiveList; |
334 #endif | 330 #endif |
335 | 331 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 GrResourceCache* fCache; | 378 GrResourceCache* fCache; |
383 }; | 379 }; |
384 #else | 380 #else |
385 class GrAutoResourceCacheValidate { | 381 class GrAutoResourceCacheValidate { |
386 public: | 382 public: |
387 GrAutoResourceCacheValidate(GrResourceCache*) {} | 383 GrAutoResourceCacheValidate(GrResourceCache*) {} |
388 }; | 384 }; |
389 #endif | 385 #endif |
390 | 386 |
391 #endif | 387 #endif |
OLD | NEW |