Commit a9f85bd5 authored by Fady Samuel's avatar Fady Samuel Committed by Commit Bot

Surface synchronization: Introduce SurfaceInfo::ToString for debugging

I find myself printing out SurfaceInfo over and over again. This is a
quick CL to upstream this.

Bug: 672962
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: Ia1a4afbbb02f20e5cb6466fd5e381da192d713c1
Reviewed-on: https://chromium-review.googlesource.com/925681Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537783}
parent 8f12ad6e
......@@ -133,6 +133,7 @@ viz_component("common") {
"surfaces/parent_local_surface_id_allocator.h",
"surfaces/surface_id.cc",
"surfaces/surface_id.h",
"surfaces/surface_info.cc",
"surfaces/surface_info.h",
"switches.cc",
"switches.h",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/viz/common/surfaces/surface_info.h"
#include "base/strings/stringprintf.h"
namespace viz {
std::string SurfaceInfo::ToString() const {
return base::StringPrintf("SurfaceInfo(%s, DeviceScaleFactor(%f), Size(%s))",
id_.ToString().c_str(), device_scale_factor_,
size_in_pixels_.ToString().c_str());
}
std::ostream& operator<<(std::ostream& out, const SurfaceInfo& surface_info) {
return out << surface_info.ToString();
}
} // namespace viz
......@@ -6,6 +6,7 @@
#define COMPONENTS_VIZ_COMMON_SURFACES_SURFACE_INFO_H_
#include "components/viz/common/surfaces/surface_id.h"
#include "components/viz/common/viz_common_export.h"
#include "ui/gfx/geometry/size.h"
namespace IPC {
......@@ -20,7 +21,7 @@ class SurfaceInfoDataView;
} // namespace mojom
// This class contains information about the surface that is being embedded.
class SurfaceInfo {
class VIZ_COMMON_EXPORT SurfaceInfo {
public:
SurfaceInfo() = default;
SurfaceInfo(const SurfaceId& id,
......@@ -47,6 +48,8 @@ class SurfaceInfo {
float device_scale_factor() const { return device_scale_factor_; }
const gfx::Size& size_in_pixels() const { return size_in_pixels_; }
std::string ToString() const;
private:
friend struct mojo::StructTraits<mojom::SurfaceInfoDataView, SurfaceInfo>;
friend struct IPC::ParamTraits<SurfaceInfo>;
......@@ -56,6 +59,9 @@ class SurfaceInfo {
gfx::Size size_in_pixels_;
};
VIZ_COMMON_EXPORT std::ostream& operator<<(std::ostream& out,
const SurfaceInfo& surface_info);
} // namespace viz
#endif // COMPONENTS_VIZ_COMMON_SURFACES_SURFACE_INFO_H_
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