Skip to content

Commit

Permalink
Remove deprecated DISALLOW_ macros from /third_party/blink/renderer/c…
Browse files Browse the repository at this point in the history
…ore/inspector

Macros such as DISALLOW_COPY_AND_ASSIGN() are deprecated since r711900
per style arbitration [1]. This commit replaces the macros with deleted
constructors and methods, which is preferred by the Google C++ Style
Guide [2][3].

Also remove unneeded "base/macros.h" #includes when possible.

[1]: https://groups.google.com/a/chromium.org/g/cxx/c/qwH2hxaEjac/m/TUKq6eqfCwAJ
[2]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
[3]: https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types

This CL was uploaded by git cl split.

R=dgozman@chromium.org

Bug: 1010217
Change-Id: I984f14eb4f025f2467d3151e2d0bdf461d05fb4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2957412
Auto-Submit: Timothy Gu <timothygu@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#891931}
  • Loading branch information
TimothyGu authored and Chromium LUCI CQ committed Jun 13, 2021
1 parent 1780c77 commit 5588f52
Show file tree
Hide file tree
Showing 41 changed files with 146 additions and 117 deletions.
Expand Up @@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_CONSOLE_MESSAGE_STORAGE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_CONSOLE_MESSAGE_STORAGE_H_

#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
Expand All @@ -19,6 +18,8 @@ class CORE_EXPORT ConsoleMessageStorage
: public GarbageCollected<ConsoleMessageStorage> {
public:
ConsoleMessageStorage();
ConsoleMessageStorage(const ConsoleMessageStorage&) = delete;
ConsoleMessageStorage& operator=(const ConsoleMessageStorage&) = delete;

// If |discard_duplicates| is set, the message will only be added if no
// console message with the same text has exists in |messages_|. Returns
Expand All @@ -36,8 +37,6 @@ class CORE_EXPORT ConsoleMessageStorage
private:
int expired_count_;
HeapDeque<Member<ConsoleMessage>> messages_;

DISALLOW_COPY_AND_ASSIGN(ConsoleMessageStorage);
};

} // namespace blink
Expand Down
5 changes: 3 additions & 2 deletions third_party/blink/renderer/core/inspector/devtools_agent.cc
Expand Up @@ -86,6 +86,9 @@ class DevToolsAgent::IOAgent : public mojom::blink::DevToolsAgent {
CrossThreadUnretained(this), std::move(receiver)));
}

IOAgent(const IOAgent&) = delete;
IOAgent& operator=(const IOAgent&) = delete;

void BindInterface(
mojo::PendingReceiver<mojom::blink::DevToolsAgent> receiver) {
DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
Expand Down Expand Up @@ -154,8 +157,6 @@ class DevToolsAgent::IOAgent : public mojom::blink::DevToolsAgent {
scoped_refptr<InspectorTaskRunner> inspector_task_runner_;
CrossThreadWeakPersistent<::blink::DevToolsAgent> agent_;
mojo::Receiver<mojom::blink::DevToolsAgent> receiver_{this};

DISALLOW_COPY_AND_ASSIGN(IOAgent);
};

DevToolsAgent::DevToolsAgent(
Expand Down
5 changes: 3 additions & 2 deletions third_party/blink/renderer/core/inspector/devtools_session.cc
Expand Up @@ -64,6 +64,9 @@ class DevToolsSession::IOSession : public mojom::blink::DevToolsSession {
CrossThreadUnretained(this), std::move(receiver)));
}

IOSession(const IOSession&) = delete;
IOSession& operator=(const IOSession&) = delete;

~IOSession() override = default;

void BindInterface(
Expand Down Expand Up @@ -104,8 +107,6 @@ class DevToolsSession::IOSession : public mojom::blink::DevToolsSession {
scoped_refptr<InspectorTaskRunner> inspector_task_runner_;
CrossThreadWeakPersistent<::blink::DevToolsSession> session_;
mojo::Receiver<mojom::blink::DevToolsSession> receiver_{this};

DISALLOW_COPY_AND_ASSIGN(IOSession);
};

DevToolsSession::DevToolsSession(
Expand Down
5 changes: 2 additions & 3 deletions third_party/blink/renderer/core/inspector/devtools_session.h
Expand Up @@ -7,7 +7,6 @@

#include <memory>
#include "base/callback.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
Expand Down Expand Up @@ -48,6 +47,8 @@ class CORE_EXPORT DevToolsSession : public GarbageCollected<DevToolsSession>,
bool client_expects_binary_responses,
const String& session_id,
scoped_refptr<base::SequencedTaskRunner> mojo_task_runner);
DevToolsSession(const DevToolsSession&) = delete;
DevToolsSession& operator=(const DevToolsSession&) = delete;
~DevToolsSession() override;

void ConnectToV8(v8_inspector::V8Inspector*, int context_group_id);
Expand Down Expand Up @@ -123,8 +124,6 @@ class CORE_EXPORT DevToolsSession : public GarbageCollected<DevToolsSession>,
InspectorAgentState v8_session_state_;
InspectorAgentState::Bytes v8_session_state_cbor_;
const String session_id_;

DISALLOW_COPY_AND_ASSIGN(DevToolsSession);
};

} // namespace blink
Expand Down
25 changes: 16 additions & 9 deletions third_party/blink/renderer/core/inspector/dom_editor.cc
Expand Up @@ -30,7 +30,6 @@

#include "third_party/blink/renderer/core/inspector/dom_editor.h"

#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
Expand All @@ -53,6 +52,8 @@ class DOMEditor::RemoveChildAction final : public InspectorHistory::Action {
: InspectorHistory::Action("RemoveChild"),
parent_node_(parent_node),
node_(node) {}
RemoveChildAction(const RemoveChildAction&) = delete;
RemoveChildAction& operator=(const RemoveChildAction&) = delete;

bool Perform(ExceptionState& exception_state) override {
anchor_node_ = node_->nextSibling();
Expand Down Expand Up @@ -81,7 +82,6 @@ class DOMEditor::RemoveChildAction final : public InspectorHistory::Action {
Member<ContainerNode> parent_node_;
Member<Node> node_;
Member<Node> anchor_node_;
DISALLOW_COPY_AND_ASSIGN(RemoveChildAction);
};

class DOMEditor::InsertBeforeAction final : public InspectorHistory::Action {
Expand All @@ -91,6 +91,8 @@ class DOMEditor::InsertBeforeAction final : public InspectorHistory::Action {
parent_node_(parent_node),
node_(node),
anchor_node_(anchor_node) {}
InsertBeforeAction(const InsertBeforeAction&) = delete;
InsertBeforeAction& operator=(const InsertBeforeAction&) = delete;

bool Perform(ExceptionState& exception_state) override {
if (node_->parentNode()) {
Expand Down Expand Up @@ -134,7 +136,6 @@ class DOMEditor::InsertBeforeAction final : public InspectorHistory::Action {
Member<Node> node_;
Member<Node> anchor_node_;
Member<RemoveChildAction> remove_child_action_;
DISALLOW_COPY_AND_ASSIGN(InsertBeforeAction);
};

class DOMEditor::RemoveAttributeAction final : public InspectorHistory::Action {
Expand All @@ -143,6 +144,8 @@ class DOMEditor::RemoveAttributeAction final : public InspectorHistory::Action {
: InspectorHistory::Action("RemoveAttribute"),
element_(element),
name_(name) {}
RemoveAttributeAction(const RemoveAttributeAction&) = delete;
RemoveAttributeAction& operator=(const RemoveAttributeAction&) = delete;

bool Perform(ExceptionState& exception_state) override {
value_ = element_->getAttribute(name_);
Expand All @@ -168,7 +171,6 @@ class DOMEditor::RemoveAttributeAction final : public InspectorHistory::Action {
Member<Element> element_;
AtomicString name_;
AtomicString value_;
DISALLOW_COPY_AND_ASSIGN(RemoveAttributeAction);
};

class DOMEditor::SetAttributeAction final : public InspectorHistory::Action {
Expand All @@ -181,6 +183,8 @@ class DOMEditor::SetAttributeAction final : public InspectorHistory::Action {
name_(name),
value_(value),
had_attribute_(false) {}
SetAttributeAction(const SetAttributeAction&) = delete;
SetAttributeAction& operator=(const SetAttributeAction&) = delete;

bool Perform(ExceptionState& exception_state) override {
const AtomicString& value = element_->getAttribute(name_);
Expand Down Expand Up @@ -214,7 +218,6 @@ class DOMEditor::SetAttributeAction final : public InspectorHistory::Action {
AtomicString value_;
bool had_attribute_;
AtomicString old_value_;
DISALLOW_COPY_AND_ASSIGN(SetAttributeAction);
};

class DOMEditor::SetOuterHTMLAction final : public InspectorHistory::Action {
Expand All @@ -227,6 +230,8 @@ class DOMEditor::SetOuterHTMLAction final : public InspectorHistory::Action {
new_node_(nullptr),
history_(MakeGarbageCollected<InspectorHistory>()),
dom_editor_(MakeGarbageCollected<DOMEditor>(history_.Get())) {}
SetOuterHTMLAction(const SetOuterHTMLAction&) = delete;
SetOuterHTMLAction& operator=(const SetOuterHTMLAction&) = delete;

bool Perform(ExceptionState& exception_state) override {
old_html_ = CreateMarkup(node_.Get());
Expand Down Expand Up @@ -268,7 +273,6 @@ class DOMEditor::SetOuterHTMLAction final : public InspectorHistory::Action {
Member<Node> new_node_;
Member<InspectorHistory> history_;
Member<DOMEditor> dom_editor_;
DISALLOW_COPY_AND_ASSIGN(SetOuterHTMLAction);
};

class DOMEditor::ReplaceWholeTextAction final
Expand All @@ -278,6 +282,8 @@ class DOMEditor::ReplaceWholeTextAction final
: InspectorHistory::Action("ReplaceWholeText"),
text_node_(text_node),
text_(text) {}
ReplaceWholeTextAction(const ReplaceWholeTextAction&) = delete;
ReplaceWholeTextAction& operator=(const ReplaceWholeTextAction&) = delete;

bool Perform(ExceptionState& exception_state) override {
old_text_ = text_node_->wholeText();
Expand All @@ -303,7 +309,6 @@ class DOMEditor::ReplaceWholeTextAction final
Member<Text> text_node_;
String text_;
String old_text_;
DISALLOW_COPY_AND_ASSIGN(ReplaceWholeTextAction);
};

class DOMEditor::ReplaceChildNodeAction final
Expand All @@ -316,6 +321,8 @@ class DOMEditor::ReplaceChildNodeAction final
parent_node_(parent_node),
new_node_(new_node),
old_node_(old_node) {}
ReplaceChildNodeAction(const ReplaceChildNodeAction&) = delete;
ReplaceChildNodeAction& operator=(const ReplaceChildNodeAction&) = delete;

bool Perform(ExceptionState& exception_state) override {
return Redo(exception_state);
Expand All @@ -342,13 +349,14 @@ class DOMEditor::ReplaceChildNodeAction final
Member<ContainerNode> parent_node_;
Member<Node> new_node_;
Member<Node> old_node_;
DISALLOW_COPY_AND_ASSIGN(ReplaceChildNodeAction);
};

class DOMEditor::SetNodeValueAction final : public InspectorHistory::Action {
public:
SetNodeValueAction(Node* node, const String& value)
: InspectorHistory::Action("SetNodeValue"), node_(node), value_(value) {}
SetNodeValueAction(const SetNodeValueAction&) = delete;
SetNodeValueAction& operator=(const SetNodeValueAction&) = delete;

bool Perform(ExceptionState&) override {
old_value_ = node_->nodeValue();
Expand All @@ -374,7 +382,6 @@ class DOMEditor::SetNodeValueAction final : public InspectorHistory::Action {
Member<Node> node_;
String value_;
String old_value_;
DISALLOW_COPY_AND_ASSIGN(SetNodeValueAction);
};

DOMEditor::DOMEditor(InspectorHistory* history) : history_(history) {}
Expand Down
5 changes: 2 additions & 3 deletions third_party/blink/renderer/core/inspector/dom_editor.h
Expand Up @@ -31,7 +31,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DOM_EDITOR_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DOM_EDITOR_H_

#include "base/macros.h"
#include "third_party/blink/renderer/core/inspector/protocol/Forward.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
Expand All @@ -48,6 +47,8 @@ class Text;
class DOMEditor final : public GarbageCollected<DOMEditor> {
public:
explicit DOMEditor(InspectorHistory*);
DOMEditor(const DOMEditor&) = delete;
DOMEditor& operator=(const DOMEditor&) = delete;

void Trace(Visitor*) const;

Expand Down Expand Up @@ -95,8 +96,6 @@ class DOMEditor final : public GarbageCollected<DOMEditor> {
class SetNodeValueAction;

Member<InspectorHistory> history_;

DISALLOW_COPY_AND_ASSIGN(DOMEditor);
};

} // namespace blink
Expand Down
5 changes: 2 additions & 3 deletions third_party/blink/renderer/core/inspector/dom_patch_support.h
Expand Up @@ -31,7 +31,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DOM_PATCH_SUPPORT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_DOM_PATCH_SUPPORT_H_

#include "base/macros.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
Expand All @@ -50,6 +49,8 @@ class DOMPatchSupport final {

public:
DOMPatchSupport(DOMEditor*, Document&);
DOMPatchSupport(const DOMPatchSupport&) = delete;
DOMPatchSupport& operator=(const DOMPatchSupport&) = delete;

void PatchDocument(const String& markup);
Node* PatchNode(Node*, const String& markup, ExceptionState&);
Expand Down Expand Up @@ -90,8 +91,6 @@ class DOMPatchSupport final {
Document* document_;

UnusedNodesMap unused_nodes_map_;

DISALLOW_COPY_AND_ASSIGN(DOMPatchSupport);
};

} // namespace blink
Expand Down

0 comments on commit 5588f52

Please sign in to comment.