Skip to content

Commit

Permalink
Standardize usage of virtual/override/final specifiers in skia/.
Browse files Browse the repository at this point in the history
The Google C++ style guide states:

  Explicitly annotate overrides of virtual functions or virtual
  destructors with an override or (less frequently) final specifier.
  Older (pre-C++11) code will use the virtual keyword as an inferior
  alternative annotation. For clarity, use exactly one of override,
  final, or virtual when declaring an override.

To better conform to these guidelines, the following constructs have
been rewritten:

- if a base class has a virtual destructor, then:
    virtual ~Foo();                   ->  ~Foo() override;
- virtual void Foo() override;        ->  void Foo() override;
- virtual void Foo() override final;  ->  void Foo() final;

This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.

Several formatting edits by clang-format were manually reverted, due to
mangling of some of the more complicate IPC macros.

BUG=417463

Review URL: https://codereview.chromium.org/825513002

Cr-Commit-Position: refs/heads/master@{#309579}
  • Loading branch information
zetafunction authored and Commit bot committed Dec 23, 2014
1 parent 1c3d9ac commit da6f19c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
12 changes: 6 additions & 6 deletions skia/ext/bitmap_platform_device_cairo.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
//
// This object takes ownership of @cairo.
BitmapPlatformDevice(const SkBitmap& other, cairo_t* cairo);
virtual ~BitmapPlatformDevice();
~BitmapPlatformDevice() override;

// Constructs a device with size |width| * |height| with contents initialized
// to zero. |is_opaque| should be set if the caller knows the bitmap will be
Expand All @@ -84,15 +84,15 @@ class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
uint8_t* data);

// Overridden from SkBaseDevice:
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
const SkClipStack&) override;
void setMatrixClip(const SkMatrix& transform,
const SkRegion& region,
const SkClipStack&) override;

// Overridden from PlatformDevice:
virtual cairo_t* BeginPlatformPaint() override;
cairo_t* BeginPlatformPaint() override;

protected:
virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo& info)
override;
SkBaseDevice* onCreateCompatibleDevice(const CreateInfo& info) override;

private:
static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
Expand Down
10 changes: 9 additions & 1 deletion skia/ext/pixel_ref_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ class TestDiscardableShader : public SkShader {

void flatten(SkWriteBuffer&) const override {}

SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader);
// Manual expansion of SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS to
// satisfy Chrome's style checker, since Skia isn't ready to make the C++11
// leap yet.
private:
static SkFlattenable* CreateProc(SkReadBuffer&);
friend class SkPrivateEffectInitializer;

public:
Factory getFactory() const override { return CreateProc; }

private:
SkBitmap bitmap_;
Expand Down

0 comments on commit da6f19c

Please sign in to comment.