Commit d27d15e5 authored by kylechar's avatar kylechar Committed by Commit Bot

Apply clang-tidy fixes to graphics code

Run clang-tidy with analyzers enabled for Chromium and apply the
automated fixes to Chrome graphics code. Also fix linter errors that
were failing presubmit on upload in the same files.

Bug: none
Change-Id: I41a020c7eae44f40a08b2018cf8e49c3be9c710c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563920Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831867}
parent 9c9b4b99
......@@ -12,7 +12,7 @@ namespace cc {
// TODO(khushalsagar): Find a better name?
struct CC_PAINT_EXPORT FrameMetadata {
FrameMetadata() {}
FrameMetadata() = default;
FrameMetadata(bool complete, base::TimeDelta duration)
: complete(complete), duration(duration) {}
......
......@@ -5,6 +5,8 @@
#ifndef CC_PAINT_IMAGE_PROVIDER_H_
#define CC_PAINT_IMAGE_PROVIDER_H_
#include <vector>
#include "base/callback.h"
#include "base/optional.h"
#include "cc/paint/decoded_draw_image.h"
......@@ -12,8 +14,6 @@
#include "cc/paint/paint_export.h"
#include "cc/paint/paint_op_buffer.h"
#include <vector>
namespace cc {
class PaintImage;
......@@ -36,7 +36,7 @@ class CC_PAINT_EXPORT ImageProvider {
ScopedResult& operator=(const ScopedResult&) = delete;
ScopedResult& operator=(ScopedResult&& other);
operator bool() const { return image_ || record_; }
explicit operator bool() const { return image_ || record_; }
const DecodedDrawImage& decoded_image() const { return image_; }
bool needs_unlock() const { return !destruction_callback_.is_null(); }
const PaintRecord* paint_record() {
......@@ -52,7 +52,7 @@ class CC_PAINT_EXPORT ImageProvider {
DestructionCallback destruction_callback_;
};
virtual ~ImageProvider() {}
virtual ~ImageProvider() = default;
// Returns either:
// 1. The DecodedDrawImage to use for this PaintImage. If no image is
......
......@@ -7,6 +7,8 @@
#include <cstdint>
#include <memory>
#include "cc/paint/paint_export.h"
#include "cc/paint/transfer_cache_entry.h"
......@@ -18,7 +20,7 @@ namespace cc {
// we need to figure out layering. crbug.com/777622
class CC_PAINT_EXPORT TransferCacheDeserializeHelper {
public:
virtual ~TransferCacheDeserializeHelper() {}
virtual ~TransferCacheDeserializeHelper() = default;
// Type safe access to an entry in the transfer cache. Returns null if the
// entry is missing or of the wrong type.
......
......@@ -32,7 +32,7 @@ enum class TransferCacheEntryType : uint32_t {
// into raw bytes that can be sent to the service.
class CC_PAINT_EXPORT ClientTransferCacheEntry {
public:
virtual ~ClientTransferCacheEntry() {}
virtual ~ClientTransferCacheEntry() = default;
// Returns the type of this entry. Combined with id, it should form a unique
// identifier.
......@@ -73,7 +73,7 @@ class CC_PAINT_EXPORT ServiceTransferCacheEntry {
// Returns true if the entry needs a GrContext during deserialization.
static bool UsesGrContext(TransferCacheEntryType type);
virtual ~ServiceTransferCacheEntry() {}
virtual ~ServiceTransferCacheEntry() = default;
// Returns the type of this entry.
virtual TransferCacheEntryType Type() const = 0;
......
......@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <string>
#include "base/check.h"
......@@ -33,7 +34,7 @@ namespace viz {
// objects.
class VIZ_COMMON_EXPORT BeginFrameObserver {
public:
virtual ~BeginFrameObserver() {}
virtual ~BeginFrameObserver() = default;
// The |args| given to OnBeginFrame is guaranteed to have
// |args|.IsValid()==true. If |args|.frame_id.source_id did not change
......
......@@ -27,7 +27,7 @@ class VIZ_COMMON_EXPORT DelayBasedTimeSourceClient {
virtual void OnTimerTick() = 0;
protected:
virtual ~DelayBasedTimeSourceClient() {}
virtual ~DelayBasedTimeSourceClient() = default;
};
// This timer implements a time source that achieves the specified interval
......
......@@ -13,7 +13,7 @@ class ContextLostObserver {
virtual void OnContextLost() = 0;
protected:
virtual ~ContextLostObserver() {}
virtual ~ContextLostObserver() = default;
};
} // namespace viz
......
......@@ -23,7 +23,7 @@ struct VIZ_COMMON_EXPORT ReturnedResource {
bool lost)
: id(id), sync_token(sync_token), count(count), lost(lost) {}
ReturnedResource() {}
ReturnedResource() = default;
bool operator==(const ReturnedResource& other) const {
return id == other.id && sync_token == other.sync_token &&
......
......@@ -4,6 +4,8 @@
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
// ParentLocalSurfaceIdAllocator has 2 accessors which do not alter state:
......@@ -21,7 +23,7 @@ class ParentLocalSurfaceIdAllocatorTest : public testing::Test {
public:
ParentLocalSurfaceIdAllocatorTest() = default;
~ParentLocalSurfaceIdAllocatorTest() override {}
~ParentLocalSurfaceIdAllocatorTest() override = default;
ParentLocalSurfaceIdAllocator& allocator() { return *allocator_.get(); }
......
......@@ -170,7 +170,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorInterface {
virtual void SetFrameSequenceNumber(uint64_t frame_sequence_number) {}
protected:
OverlayProcessorInterface() {}
OverlayProcessorInterface() = default;
private:
DISALLOW_COPY_AND_ASSIGN(OverlayProcessorInterface);
......
......@@ -13,7 +13,7 @@ namespace viz {
class SoftwareOutputDeviceClient {
public:
virtual ~SoftwareOutputDeviceClient() {}
virtual ~SoftwareOutputDeviceClient() = default;
// Specify the CALayer parameters used to display the content drawn by this
// device on macOS.
......
......@@ -15,9 +15,6 @@ SurfaceResourceHolder::SurfaceResourceHolder(
SurfaceResourceHolder::~SurfaceResourceHolder() = default;
SurfaceResourceHolder::ResourceRefs::ResourceRefs()
: refs_received_from_child(0), refs_holding_resource_alive(0) {}
void SurfaceResourceHolder::Reset() {
resource_id_info_map_.clear();
}
......
......@@ -6,6 +6,7 @@
#define COMPONENTS_VIZ_SERVICE_FRAME_SINKS_SURFACE_RESOURCE_HOLDER_H_
#include <unordered_map>
#include <vector>
#include "base/macros.h"
#include "components/viz/common/resources/resource_id.h"
......@@ -34,10 +35,8 @@ class VIZ_SERVICE_EXPORT SurfaceResourceHolder {
SurfaceResourceHolderClient* client_;
struct ResourceRefs {
ResourceRefs();
int refs_received_from_child;
int refs_holding_resource_alive;
int refs_received_from_child = 0;
int refs_holding_resource_alive = 0;
gpu::SyncToken sync_token;
};
// Keeps track of the number of users currently in flight for each resource
......
......@@ -15,7 +15,7 @@ class LatestLocalSurfaceIdLookupDelegate {
const FrameSinkId& frame_sink_id) const = 0;
protected:
virtual ~LatestLocalSurfaceIdLookupDelegate() {}
virtual ~LatestLocalSurfaceIdLookupDelegate() = default;
};
} // namespace viz
......
......@@ -364,7 +364,7 @@ void Surface::RecomputeActiveReferencedSurfaces() {
active_referenced_surfaces_.insert(surface->surface_id());
last_surface_id_for_range_.push_back(surface->surface_id());
} else {
last_surface_id_for_range_.push_back(SurfaceId());
last_surface_id_for_range_.emplace_back();
}
// The allocation group for the end of the SurfaceRange should always be
// referenced.
......
......@@ -9,7 +9,7 @@ namespace viz {
FakeSurfaceObserver::FakeSurfaceObserver(bool damage_display)
: damage_display_(damage_display) {}
FakeSurfaceObserver::~FakeSurfaceObserver() {}
FakeSurfaceObserver::~FakeSurfaceObserver() = default;
void FakeSurfaceObserver::Reset() {
last_ack_ = BeginFrameAck();
......
......@@ -44,7 +44,7 @@ class GpuMemoryBufferManager;
// synchronized using SyncTokens. See //docs/design/gpu_synchronization.md.
class GPU_EXPORT SharedImageInterface {
public:
virtual ~SharedImageInterface() {}
virtual ~SharedImageInterface() = default;
// Creates a shared image of requested |format|, |size| and |color_space|.
// |usage| is a combination of |SharedImageUsage| bits that describes which
......
......@@ -66,8 +66,8 @@ class GPU_GLES2_EXPORT SharedContextState
public:
using ContextLostCallback = base::OnceCallback<void(bool)>;
// TODO: Refactor code to have seperate constructor for GL and Vulkan and not
// initialize/use GL related info for vulkan and vice-versa.
// TODO(vikassoni): Refactor code to have seperate constructor for GL and
// Vulkan and not initialize/use GL related info for vulkan and vice-versa.
SharedContextState(
scoped_refptr<gl::GLShareGroup> share_group,
scoped_refptr<gl::GLSurface> surface,
......@@ -182,7 +182,7 @@ class GPU_GLES2_EXPORT SharedContextState
virtual void OnContextLost() = 0;
protected:
virtual ~ContextLostObserver() {}
virtual ~ContextLostObserver() = default;
};
void AddContextLostObserver(ContextLostObserver* obs);
void RemoveContextLostObserver(ContextLostObserver* obs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment