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

Side by Side Diff: src/gpu/GrResourceCache.cpp

Issue 1313743002: Add onMemoryDump to GrContext (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Small build fix Created 5 years, 3 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 | « src/gpu/GrResourceCache.h ('k') | src/gpu/gl/GrGLIndexBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 #include "GrResourceCache.h" 10 #include "GrResourceCache.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 SkASSERT(SkIsPow2(fMaxUnusedFlushes)); 609 SkASSERT(SkIsPow2(fMaxUnusedFlushes));
610 fLastFlushTimestampIndex = (fLastFlushTimestampIndex + 1) & (fMaxUnusedF lushes - 1); 610 fLastFlushTimestampIndex = (fLastFlushTimestampIndex + 1) & (fMaxUnusedF lushes - 1);
611 // get the timestamp before accessing fFlushTimestamps because getNextTi mestamp will 611 // get the timestamp before accessing fFlushTimestamps because getNextTi mestamp will
612 // reallocate fFlushTimestamps on timestamp overflow. 612 // reallocate fFlushTimestamps on timestamp overflow.
613 uint32_t timestamp = this->getNextTimestamp(); 613 uint32_t timestamp = this->getNextTimestamp();
614 fFlushTimestamps[fLastFlushTimestampIndex] = timestamp; 614 fFlushTimestamps[fLastFlushTimestampIndex] = timestamp;
615 this->purgeAsNeeded(); 615 this->purgeAsNeeded();
616 } 616 }
617 } 617 }
618 618
619 void GrResourceCache::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) c onst {
620 for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
621 fNonpurgeableResources[i]->dumpMemoryStatistics(traceMemoryDump);
622 }
623 for (int i = 0; i < fPurgeableQueue.count(); ++i) {
624 fPurgeableQueue.at(i)->dumpMemoryStatistics(traceMemoryDump);
625 }
626 }
627
619 #ifdef SK_DEBUG 628 #ifdef SK_DEBUG
620 void GrResourceCache::validate() const { 629 void GrResourceCache::validate() const {
621 // Reduce the frequency of validations for large resource counts. 630 // Reduce the frequency of validations for large resource counts.
622 static SkRandom gRandom; 631 static SkRandom gRandom;
623 int mask = (SkNextPow2(fCount + 1) >> 5) - 1; 632 int mask = (SkNextPow2(fCount + 1) >> 5) - 1;
624 if (~mask && (gRandom.nextU() & mask)) { 633 if (~mask && (gRandom.nextU() & mask)) {
625 return; 634 return;
626 } 635 }
627 636
628 struct Stats { 637 struct Stats {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 return true; 733 return true;
725 } 734 }
726 if (index < fNonpurgeableResources.count() && fNonpurgeableResources[index] == resource) { 735 if (index < fNonpurgeableResources.count() && fNonpurgeableResources[index] == resource) {
727 return true; 736 return true;
728 } 737 }
729 SkDEBUGFAIL("Resource index should be -1 or the resource should be in the ca che."); 738 SkDEBUGFAIL("Resource index should be -1 or the resource should be in the ca che.");
730 return false; 739 return false;
731 } 740 }
732 741
733 #endif 742 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | src/gpu/gl/GrGLIndexBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698