0

[ToTLinux] Fix some narrowing errors

The compilation errors mentioned in the issue can be reproduced on the
local ToT, and the following new errors are found, which will be fixed
in this CL.

In file included from ../../cc/layers/mirror_layer_impl.cc:5:
../../cc/layers/mirror_layer_impl.h:59:40: error: non-constant-expressi
on cannot be narrowed from type 'int' to 'unsigned long' in initializer
list [-Wc++11-narrowing-const-reference]
   59 |     return viz::CompositorRenderPassId{mirrored_layer_id()};
      |                                        ^~~~~~~~~~~~~~~~~~~
1 error generated.

Fixed: 1513724
Change-Id: I562534d13f82824dfac0fe3e78a45c8c49d5841a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5150303
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Ho Cheung <uioptt24@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1244427}
This commit is contained in:
Ho Cheung
2024-01-09 03:05:37 +00:00
committed by Chromium LUCI CQ
parent f7eb70702a
commit 5e9fb4130a
2 changed files with 5 additions and 3 deletions

@ -5,6 +5,7 @@
#ifndef CC_LAYERS_MIRROR_LAYER_IMPL_H_
#define CC_LAYERS_MIRROR_LAYER_IMPL_H_
#include <cstdint>
#include <memory>
#include "base/memory/ptr_util.h"
@ -56,7 +57,8 @@ class CC_EXPORT MirrorLayerImpl : public LayerImpl {
private:
const char* LayerTypeAsString() const override;
viz::CompositorRenderPassId mirrored_layer_render_pass_id() const {
return viz::CompositorRenderPassId{mirrored_layer_id()};
return viz::CompositorRenderPassId{
static_cast<uint64_t>(mirrored_layer_id())};
}
int mirrored_layer_id_ = 0;

@ -61,9 +61,9 @@ bool ReadDoubleFromFile(base::FilePath path, double* output) {
// value of less than 1. Here, we only consider cpu0. See details in
// https://man7.org/linux/man-pages/man2/perf_event_open.2.html.
base::ScopedFD OpenPerfEvent(perf_event_attr* perf_attr) {
base::ScopedFD perf_fd{syscall(__NR_perf_event_open, perf_attr, /*pid=*/-1,
base::ScopedFD perf_fd(syscall(__NR_perf_event_open, perf_attr, /*pid=*/-1,
/*cpu=*/0, /*group_fd=*/-1,
PERF_FLAG_FD_CLOEXEC)};
static_cast<int>(PERF_FLAG_FD_CLOEXEC)));
return perf_fd;
}