#include "third_party/blink/renderer/core/inspector/inspector_layer_tree_agent.h"
#include <memory>
#include "cc/base/region.h"
#include "cc/layers/picture_layer.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/transform_node.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/inspector/inspected_frames.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/platform/graphics/compositing_reasons.h"
#include "third_party/blink/renderer/platform/graphics/compositor_element_id.h"
#include "third_party/blink/renderer/platform/graphics/picture_snapshot.h"
#include "third_party/blink/renderer/platform/wtf/text/base64.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/inspector_protocol/crdtp/json.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/transform.h"
namespace blink {
Array;
Maybe;
unsigned InspectorLayerTreeAgent::last_snapshot_id_;
inline String IdForLayer(const cc::Layer* layer) { … }
static std::unique_ptr<protocol::DOM::Rect> BuildObjectForRect(
const gfx::Rect& rect) { … }
static std::unique_ptr<protocol::DOM::Rect> BuildObjectForRect(
const gfx::RectF& rect) { … }
static std::unique_ptr<protocol::LayerTree::ScrollRect> BuildScrollRect(
const gfx::Rect& rect,
const String& type) { … }
static std::unique_ptr<Array<protocol::LayerTree::ScrollRect>>
BuildScrollRectsForLayer(const cc::Layer* layer) { … }
static const cc::Layer* FindLayerByElementId(const cc::Layer* root,
CompositorElementId element_id) { … }
static std::unique_ptr<protocol::LayerTree::StickyPositionConstraint>
BuildStickyInfoForLayer(const cc::Layer* root, const cc::Layer* layer) { … }
static std::unique_ptr<protocol::LayerTree::Layer> BuildObjectForLayer(
const cc::Layer* root,
const cc::Layer* layer) { … }
InspectorLayerTreeAgent::InspectorLayerTreeAgent(
InspectedFrames* inspected_frames,
Client* client)
: … { … }
InspectorLayerTreeAgent::~InspectorLayerTreeAgent() = default;
void InspectorLayerTreeAgent::Trace(Visitor* visitor) const { … }
void InspectorLayerTreeAgent::Restore() { … }
protocol::Response InspectorLayerTreeAgent::enable() { … }
protocol::Response InspectorLayerTreeAgent::disable() { … }
void InspectorLayerTreeAgent::LayerTreeDidChange() { … }
void InspectorLayerTreeAgent::LayerTreePainted() { … }
std::unique_ptr<Array<protocol::LayerTree::Layer>>
InspectorLayerTreeAgent::BuildLayerTree() { … }
void InspectorLayerTreeAgent::GatherLayers(
const cc::Layer* layer,
std::unique_ptr<Array<protocol::LayerTree::Layer>>& layers) { … }
const cc::Layer* InspectorLayerTreeAgent::RootLayer() { … }
static const cc::Layer* FindLayerById(const cc::Layer* root, int layer_id) { … }
protocol::Response InspectorLayerTreeAgent::LayerById(
const String& layer_id,
const cc::Layer*& result) { … }
protocol::Response InspectorLayerTreeAgent::compositingReasons(
const String& layer_id,
std::unique_ptr<Array<String>>* compositing_reasons,
std::unique_ptr<Array<String>>* compositing_reason_ids) { … }
protocol::Response InspectorLayerTreeAgent::makeSnapshot(const String& layer_id,
String* snapshot_id) { … }
protocol::Response InspectorLayerTreeAgent::loadSnapshot(
std::unique_ptr<Array<protocol::LayerTree::PictureTile>> tiles,
String* snapshot_id) { … }
protocol::Response InspectorLayerTreeAgent::releaseSnapshot(
const String& snapshot_id) { … }
protocol::Response InspectorLayerTreeAgent::GetSnapshotById(
const String& snapshot_id,
const PictureSnapshot*& result) { … }
protocol::Response InspectorLayerTreeAgent::replaySnapshot(
const String& snapshot_id,
Maybe<int> from_step,
Maybe<int> to_step,
Maybe<double> scale,
String* data_url) { … }
static void ParseRect(protocol::DOM::Rect& object, gfx::RectF* rect) { … }
protocol::Response InspectorLayerTreeAgent::profileSnapshot(
const String& snapshot_id,
Maybe<int> min_repeat_count,
Maybe<double> min_duration,
Maybe<protocol::DOM::Rect> clip_rect,
std::unique_ptr<protocol::Array<protocol::Array<double>>>* out_timings) { … }
protocol::Response InspectorLayerTreeAgent::snapshotCommandLog(
const String& snapshot_id,
std::unique_ptr<Array<protocol::DictionaryValue>>* command_log) { … }
}