Get the smallest frame number (or NULL shared_ptr if no frame is found)
| 115 | |
| 116 | // Get the smallest frame number (or NULL shared_ptr if no frame is found) |
| 117 | std::shared_ptr<Frame> CacheMemory::GetSmallestFrame() |
| 118 | { |
| 119 | // Create a scoped lock, to protect the cache from multiple threads |
| 120 | const std::lock_guard<std::recursive_mutex> lock(*cacheMutex); |
| 121 | |
| 122 | // Loop through frame numbers |
| 123 | std::deque<int64_t>::iterator itr; |
| 124 | int64_t smallest_frame = -1; |
| 125 | for(itr = frame_numbers.begin(); itr != frame_numbers.end(); ++itr) |
| 126 | { |
| 127 | if (*itr < smallest_frame || smallest_frame == -1) |
| 128 | smallest_frame = *itr; |
| 129 | } |
| 130 | |
| 131 | // Return frame (if any) |
| 132 | if (smallest_frame != -1) { |
| 133 | return frames[smallest_frame]; |
| 134 | } else { |
| 135 | return NULL; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | // Gets the maximum bytes value |
| 140 | int64_t CacheMemory::GetBytes() |
nothing calls this directly
no outgoing calls
no test coverage detected