chromium/extensions/renderer/shared_l10n_map.h

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef EXTENSIONS_RENDERER_SHARED_L10N_MAP_H_
#define EXTENSIONS_RENDERER_SHARED_L10N_MAP_H_

#include <map>
#include <string>

#include "base/synchronization/lock.h"
#include "extensions/common/extension_id.h"

namespace extensions {

namespace mojom {
class RendererHost;
}

// A helper class to retrieve l10n data for extensions. Since renderers are
// always tied to a specific profile, this class is safe as a singleton (we
// don't need to worry about extensions in other profiles).
//
// This class is thread-safe.
//
// NOTA BENE: ALL METHODS THAT RETRIEVE OR REPLACE MESSAGES MAY RESULT IN A
// SYNC IPC TO THE BROWSER PROCESS AND/OR WAITING FOR A THREAD LOCK.
//
// In practice, the above is not as *quite* bad as it sounds (though still not
// ideal): we cache the retrieved data for extensions, so a maximum of a single
// IPC will be sent per extension per process. Additionally, extensions will
// usually only be accessing this data on a single thread at a time.
class SharedL10nMap {};

}  // namespace extensions

#endif  // EXTENSIONS_RENDERER_SHARED_L10N_MAP_H_