Flutter Engine
The Flutter Engine
resource_cache_limit_calculator.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/common/resource_cache_limit_calculator.h"
6
7namespace flutter {
8
10 size_t max_bytes = 0;
11 size_t max_bytes_threshold = max_bytes_threshold_ > 0
12 ? max_bytes_threshold_
14 std::vector<fml::WeakPtr<ResourceCacheLimitItem>> live_items;
15 for (const auto& item : items_) {
16 if (item) {
17 live_items.push_back(item);
18 max_bytes += item->GetResourceCacheLimit();
19 }
20 }
21 items_ = std::move(live_items);
22 return std::min(max_bytes, max_bytes_threshold);
23}
24
25} // namespace flutter
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48