#include "components/performance_manager/v8_memory/web_memory_impl.h"
#include <memory>
#include <utility>
#include "base/check.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "components/performance_manager/public/graph/frame_node.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/graph/page_node.h"
#include "components/performance_manager/public/graph/process_node.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/render_frame_host_proxy.h"
#include "components/performance_manager/public/v8_memory/web_memory.h"
#include "components/performance_manager/v8_memory/web_memory_aggregator.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace performance_manager {
namespace v8_memory {
namespace {
mojom::WebMemoryMeasurementPtr BuildMemoryUsageResult(
const blink::LocalFrameToken& frame_token,
const ProcessNode* process_node) { … }
v8_memory::V8DetailedMemoryRequest::MeasurementMode
WebMeasurementModeToRequestMeasurementMode(
mojom::WebMemoryMeasurement::Mode mode) { … }
void CheckIsCrossOriginIsolatedOnUISeq(
const RenderFrameHostProxy& rfh_proxy,
WebMeasureMemorySecurityChecker::MeasureMemoryCallback
measure_memory_callback,
mojo::ReportBadMessageCallback bad_message_callback) { … }
}
WebMemoryMeasurer::WebMemoryMeasurer(
const blink::LocalFrameToken& frame_token,
V8DetailedMemoryRequest::MeasurementMode mode,
MeasurementCallback callback)
: … { … }
WebMemoryMeasurer::~WebMemoryMeasurer() = default;
void WebMemoryMeasurer::MeasureMemory(mojom::WebMemoryMeasurement::Mode mode,
MeasurementCallback callback,
base::WeakPtr<FrameNode> frame_node) { … }
void WebMemoryMeasurer::MeasurementComplete(
const ProcessNode* process_node,
const V8DetailedMemoryProcessData*) { … }
std::unique_ptr<WebMeasureMemorySecurityChecker>
WebMeasureMemorySecurityChecker::Create() { … }
void WebMeasureMemorySecurityCheckerImpl::CheckMeasureMemoryIsAllowed(
const FrameNode* frame,
MeasureMemoryCallback measure_memory_callback,
mojo::ReportBadMessageCallback bad_message_callback) const { … }
void WebMeasureMemory(
const FrameNode* frame_node,
mojom::WebMemoryMeasurement::Mode mode,
std::unique_ptr<WebMeasureMemorySecurityChecker> security_checker,
base::OnceCallback<void(mojom::WebMemoryMeasurementPtr)> result_callback,
mojo::ReportBadMessageCallback bad_message_callback) { … }
}
}