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/testing

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=dcheng@chromium.org

Bug: 1010217
Change-Id: I44c4fd871b2c0f1ea9661d0ecf313bf62a91b0d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2957418
Auto-Submit: Timothy Gu <timothygu@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#891995}
  • Loading branch information
TimothyGu authored and Chromium LUCI CQ committed Jun 14, 2021
1 parent 5392e17 commit 368b10c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/testing/dummy_modulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class ModuleRecordResolver;
// implementation. Unit tests can implement a subset of Modulator interface
// which is exercised from unit-under-test.
class DummyModulator : public Modulator {
DISALLOW_COPY_AND_ASSIGN(DummyModulator);

public:
DummyModulator();
DummyModulator(const DummyModulator&) = delete;
DummyModulator& operator=(const DummyModulator&) = delete;
~DummyModulator() override;
void Trace(Visitor*) const override;

Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/testing/dummy_page_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/time/default_tick_clock.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/page/page.h"
Expand Down Expand Up @@ -76,6 +75,8 @@ class DummyPageHolder {
base::OnceCallback<void(Settings&)> setting_overrider =
base::NullCallback(),
const base::TickClock* clock = base::DefaultTickClock::GetInstance());
DummyPageHolder(const DummyPageHolder&) = delete;
DummyPageHolder& operator=(const DummyPageHolder&) = delete;
~DummyPageHolder();

Page& GetPage() const;
Expand All @@ -100,7 +101,6 @@ class DummyPageHolder {

Persistent<LocalFrameClient> local_frame_client_;
std::unique_ptr<scheduler::WebAgentGroupScheduler> agent_group_scheduler_;
DISALLOW_COPY_AND_ASSIGN(DummyPageHolder);
};

} // namespace blink
Expand Down
5 changes: 3 additions & 2 deletions third_party/blink/renderer/core/testing/internals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <memory>
#include <utility>

#include "base/macros.h"
#include "base/process/process_handle.h"
#include "cc/layers/picture_layer.h"
#include "cc/trees/layer_tree_host.h"
Expand Down Expand Up @@ -215,6 +214,9 @@ class UseCounterImplObserverImpl final : public UseCounterImpl::Observer {
UseCounterImplObserverImpl(ScriptPromiseResolver* resolver,
WebFeature feature)
: resolver_(resolver), feature_(feature) {}
UseCounterImplObserverImpl(const UseCounterImplObserverImpl&) = delete;
UseCounterImplObserverImpl& operator=(const UseCounterImplObserverImpl&) =
delete;

bool OnCountFeature(WebFeature feature) final {
if (feature_ != feature)
Expand All @@ -231,7 +233,6 @@ class UseCounterImplObserverImpl final : public UseCounterImpl::Observer {
private:
Member<ScriptPromiseResolver> resolver_;
WebFeature feature_;
DISALLOW_COPY_AND_ASSIGN(UseCounterImplObserverImpl);
};

class TestReadableStreamSource : public UnderlyingSourceBase {
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/testing/mock_clipboard_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace blink {
class MockClipboardHost : public mojom::blink::ClipboardHost {
public:
MockClipboardHost();
MockClipboardHost(const MockClipboardHost&) = delete;
MockClipboardHost& operator=(const MockClipboardHost&) = delete;
~MockClipboardHost() override;

void Bind(mojo::PendingReceiver<mojom::blink::ClipboardHost> receiver);
Expand Down Expand Up @@ -68,8 +70,6 @@ class MockClipboardHost : public mojom::blink::ClipboardHost {
HashMap<String, String> custom_data_;
bool write_smart_paste_ = false;
bool needs_reset_ = false;

DISALLOW_COPY_AND_ASSIGN(MockClipboardHost);
};

} // namespace blink
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/testing/static_selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class StaticSelection final : public ScriptWrappable {

explicit StaticSelection(const SelectionInFlatTree&);
explicit StaticSelection(const SelectionInDOMTree&);
StaticSelection(const StaticSelection&) = delete;
StaticSelection& operator=(const StaticSelection&) = delete;

Node* anchorNode() const { return anchor_node_; }
unsigned anchorOffset() const { return anchor_offset_; }
Expand All @@ -36,8 +38,6 @@ class StaticSelection final : public ScriptWrappable {
const unsigned anchor_offset_;
const Member<Node> focus_node_;
const unsigned focus_offset_;

DISALLOW_COPY_AND_ASSIGN(StaticSelection);
};

} // namespace blink
Expand Down

0 comments on commit 368b10c

Please sign in to comment.