diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/content_capture/task_session.h')
-rw-r--r-- | chromium/third_party/blink/renderer/core/content_capture/task_session.h | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/chromium/third_party/blink/renderer/core/content_capture/task_session.h b/chromium/third_party/blink/renderer/core/content_capture/task_session.h index b91c1ac3589..e648a52f396 100644 --- a/chromium/third_party/blink/renderer/core/content_capture/task_session.h +++ b/chromium/third_party/blink/renderer/core/content_capture/task_session.h @@ -6,19 +6,19 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CONTENT_CAPTURE_TASK_SESSION_H_ #include <utility> -#include <vector> #include "base/callback.h" #include "base/memory/scoped_refptr.h" -#include "cc/paint/node_holder.h" +#include "cc/paint/node_id.h" +#include "third_party/blink/public/platform/web_vector.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" +#include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { -class ContentHolder; class Document; class SentNodes; @@ -35,7 +35,7 @@ class SentNodes; // they are saved to the DocumentSession directly. // // ContentCaptureTask gets the data per document by using -// GetUnsentDocumentSession() and GetNextUnsentContentHolder(), and must send +// GetUnsentDocumentSession() and GetNextUnsentNode(), and must send // all data out before capturing on-screen content again. class TaskSession : public GarbageCollectedFinalized<TaskSession> { public: @@ -52,26 +52,27 @@ class TaskSession : public GarbageCollectedFinalized<TaskSession> { SentNodes& sent_nodes, SentNodeCountCallback& call_back); ~DocumentSession(); - void AddNodeHolder(cc::NodeHolder node_holder); + void AddCapturedNode(Node& node); void AddDetachedNode(int64_t id); - void AddChangedNodeHolder(cc::NodeHolder node); + void AddChangedNode(Node& node); bool HasUnsentData() const { return HasUnsentCapturedContent() || HasUnsentChangedContent() || HasUnsentDetachedNodes(); } - bool HasUnsentCapturedContent() const { return !captured_content_.empty(); } - bool HasUnsentChangedContent() const { return !changed_content_.empty(); } + bool HasUnsentCapturedContent() const { + return !captured_content_.IsEmpty(); + } + bool HasUnsentChangedContent() const { return !changed_content_.IsEmpty(); } bool HasUnsentDetachedNodes() const { return !detached_nodes_.empty(); } - std::vector<int64_t> MoveDetachedNodes(); + WebVector<int64_t> MoveDetachedNodes(); const Document* GetDocument() const { return document_; } bool FirstDataHasSent() const { return first_data_has_sent_; } void SetFirstDataHasSent() { first_data_has_sent_ = true; } - // Removes the unsent node from |captured_content_|, and returns it as - // ContentHolder. - scoped_refptr<ContentHolder> GetNextUnsentContentHolder(); + // Removes the unsent node from |captured_content_|, and returns it. + Node* GetNextUnsentNode(); - scoped_refptr<ContentHolder> GetNextChangedContentHolder(); + Node* GetNextChangedNode(); // Resets the |captured_content_| and the |detached_nodes_|, shall only be // used if those data doesn't need to be sent, e.g. there is no @@ -82,20 +83,20 @@ class TaskSession : public GarbageCollectedFinalized<TaskSession> { private: // The captured content that belongs to this document. - std::vector<cc::NodeHolder> captured_content_; + HeapHashSet<WeakMember<Node>> captured_content_; // The list of content id of node that has been detached from the // LayoutTree. - std::vector<int64_t> detached_nodes_; + WebVector<int64_t> detached_nodes_; WeakMember<const Document> document_; Member<SentNodes> sent_nodes_; // The list of changed nodes that needs to be sent. - std::vector<cc::NodeHolder> changed_content_; + HeapHashSet<WeakMember<Node>> changed_content_; bool first_data_has_sent_ = false; // This is for the metrics to record the total node that has been sent. size_t total_sent_nodes_ = 0; // Histogram could be disabed in low time resolution OS, see - // TimeTicks::IsHighResolution and ContentCaptureTask. + // base::TimeTicks::IsHighResolution and ContentCaptureTask. base::Optional<SentNodeCountCallback> callback_; }; @@ -106,11 +107,11 @@ class TaskSession : public GarbageCollectedFinalized<TaskSession> { // This can only be invoked when all data has been sent (i.e. HasUnsentData() // returns False). - void SetCapturedContent(const std::vector<cc::NodeHolder>& captured_content); + void SetCapturedContent(const Vector<cc::NodeId>& captured_content); - void OnNodeDetached(const cc::NodeHolder& node_holder); + void OnNodeDetached(const Node& node); - void OnNodeChanged(const cc::NodeHolder& node_holder); + void OnNodeChanged(Node& node); bool HasUnsentData() const { return has_unsent_data_; } @@ -125,16 +126,14 @@ class TaskSession : public GarbageCollectedFinalized<TaskSession> { private: void GroupCapturedContentByDocument( - const std::vector<cc::NodeHolder>& captured_content); + const Vector<cc::NodeId>& captured_content); DocumentSession& EnsureDocumentSession(const Document& doc); DocumentSession* GetDocumentSession(const Document& document) const; - const Node* GetNodeIf(bool sent, const cc::NodeHolder& node_holder) const; - const Node* GetNode(const cc::NodeHolder& node_holder) const; Member<SentNodes> sent_nodes_; // The list of node whose value has changed. - HeapHashSet<WeakMember<const Node>> changed_nodes_; + HeapHashSet<WeakMember<Node>> changed_nodes_; // This owns the DocumentSession which is released along with Document. HeapHashMap<WeakMember<const Document>, Member<DocumentSession>> |