chromium/content/browser/renderer_host/batched_proxy_ipc_sender.h

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

#ifndef CONTENT_BROWSER_RENDERER_HOST_BATCHED_PROXY_IPC_SENDER_H_
#define CONTENT_BROWSER_RENDERER_HOST_BATCHED_PROXY_IPC_SENDER_H_

#include <map>
#include <vector>

#include "base/memory/safe_ref.h"
#include "content/common/content_export.h"
#include "content/public/browser/global_routing_id.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-forward.h"
#include "third_party/blink/public/mojom/frame/frame_replication_state.mojom-forward.h"
#include "third_party/blink/public/mojom/frame/remote_frame.mojom.h"

namespace blink {
namespace mojom {
enum class TreeScopeType;
}  // namespace mojom
}  // namespace blink

namespace content {

class RenderFrameProxyHost;

// Used to batch create proxies for child frames within a `SiteInstanceGroup`.
//
// This is only used when proxies within a single `FrameTree` are created by
// `CreateProxiesForSiteInstance()`. There are 2 cases:
// (1) A subframe navigates to a new `SiteInstance`.
// (2) An opener chain created by a child/main frame navigation, in which case
// the navigating `FrameTree` will batch create proxies only for a child frame
// navigation. All other `FrameTree`s will create their own instance of
// `BatchedProxyIPCSender` to batch create proxies.
//
// `CreateProxiesForSiteInstance()` iterates through the `FrameTree` in breadth
// first order, and normally creates a proxy for a `FrameTreeNode` if needed.
// If this class is used for batch creation, a node with the necessary
// parameters for proxy creation will be added to
// `create_remote_children_params_` instead of creating the proxy
// immediately. After iterating the `FrameTree`, all child frames can be
// created with `CreateAllProxies()`. See doc in https://crbug.com/1393697 for
// more details.
//
// Note: When any frame in a frame tree navigates to a `SiteInstance` X,
// there are two cases: either (1) X is a new `SiteInstance`, in which case
// all `FrameTreeNode`s will need a new proxy, and hence we'll start creating
// proxies from the root; or (2) X is an existing `SiteInstance` that may
// already have some frames in it, in which case Chromium guarantees that all
// `FrameTreeNode`s on the page would either be actual frames in X or already
// have proxies for X. In either case, there shouldn't be a need to create
// additional proxies for just a part of a `FrameTree`, so this class can
// assume that new proxies will start to be created from the root.
class CONTENT_EXPORT BatchedProxyIPCSender {};

}  // namespace content

#endif  // CONTENT_BROWSER_RENDERER_HOST_BATCHED_PROXY_IPC_SENDER_H_