<commit_before>// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/memory/discardable_memory_emulated.h"

#include "base/lazy_instance.h"
#include "base/memory/discardable_memory_manager.h"

namespace base {
namespace {

// This is admittedly pretty magical. It's approximately enough memory for eight
// 2560x1600 images.
const size_t kEmulatedMemoryLimit = 128 * 1024 * 1024;
const size_t kEmulatedBytesToKeepUnderModeratePressure = 12 * 1024 * 1024;

struct SharedState {
  SharedState()
      : manager(kEmulatedMemoryLimit,
                kEmulatedBytesToKeepUnderModeratePressure) {}

  internal::DiscardableMemoryManager manager;
};
LazyInstance<SharedState>::Leaky g_shared_state = LAZY_INSTANCE_INITIALIZER;

}  // namespace

namespace internal {

DiscardableMemoryEmulated::DiscardableMemoryEmulated(size_t bytes)<commit_msg>Revert 268371 "base: Increase emulated discardable memory limit."<commit_after>// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/memory/discardable_memory_emulated.h"

#include "base/lazy_instance.h"
#include "base/memory/discardable_memory_manager.h"

namespace base {
namespace {

// This is admittedly pretty magical. It's approximately enough memory for four
// 2560x1600 images.
const size_t kEmulatedMemoryLimit = 64 * 1024 * 1024;
const size_t kEmulatedBytesToKeepUnderModeratePressure =
    kEmulatedMemoryLimit / 4;

struct SharedState {
  SharedState()
      : manager(kEmulatedMemoryLimit,
                kEmulatedBytesToKeepUnderModeratePressure) {}

  internal::DiscardableMemoryManager manager;
};
LazyInstance<SharedState>::Leaky g_shared_state = LAZY_INSTANCE_INITIALIZER;

}  // namespace

namespace internal {

DiscardableMemoryEmulated::DiscardableMemoryEmulated(size_t bytes)
{'fraction_non_alphanumeric': 0.07680722891566265, 'fraction_numerical': 0.03112449799196787, 'mean_word_length': 5.076219512195122, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5819637', 'n_tokens_mistral': 655, 'n_tokens_neox': 578, 'n_words': 159}