Moves PeakGpuMemoryTracker and PeakGpuMemoryCallback to
//components/viz/common/resources. This CL moves PeakGpuMemoryTracker and PeakGpuMemoryCallback to //components/viz/common/resources from //components/input and //content/common respectively. PeakGpuMemoryTracker interface is also going to be implemented on VizCompositorThread (GPU process) to track GPU memory usage when scrolls are handled in GPU process with InputVizard. Since //components/input is primarily focused on input, but we also track peak GPU memory usage for page loads and tab changes, it's not the most suitable location. Moving these classes to //components/viz/common/resources promotes better code organization. Bug: b:365541296 Change-Id: I4a32f0e07d525db12977ca2d0f45f7eced905820 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6011681 Reviewed-by: Jonathan Ross <jonross@chromium.org> Reviewed-by: Alexander Timin <altimin@chromium.org> Commit-Queue: Aman Verma <amanvr@google.com> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/main@{#1384537}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
aec090d075
commit
c59efd0625
chrome/browser
components
input
viz
content
@ -384,11 +384,11 @@ void CompositorView::OnTabChanged(
|
|||||||
if (!compositor_) {
|
if (!compositor_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> tracker =
|
std::unique_ptr<viz::PeakGpuMemoryTracker> tracker =
|
||||||
content::PeakGpuMemoryTrackerFactory::Create(
|
content::PeakGpuMemoryTrackerFactory::Create(
|
||||||
input::PeakGpuMemoryTracker::Usage::CHANGE_TAB);
|
viz::PeakGpuMemoryTracker::Usage::CHANGE_TAB);
|
||||||
compositor_->RequestSuccessfulPresentationTimeForNextFrame(base::BindOnce(
|
compositor_->RequestSuccessfulPresentationTimeForNextFrame(base::BindOnce(
|
||||||
[](std::unique_ptr<input::PeakGpuMemoryTracker> tracker,
|
[](std::unique_ptr<viz::PeakGpuMemoryTracker> tracker,
|
||||||
const viz::FrameTimingDetails& frame_timing_details) {
|
const viz::FrameTimingDetails& frame_timing_details) {
|
||||||
// This callback will be ran once the content::Compositor presents the
|
// This callback will be ran once the content::Compositor presents the
|
||||||
// next frame. The destruction of |tracker| will get the peak GPU memory
|
// next frame. The destruction of |tracker| will get the peak GPU memory
|
||||||
|
@ -285,9 +285,9 @@ bool BrowserTabStripController::IsTabPinned(int model_index) const {
|
|||||||
|
|
||||||
void BrowserTabStripController::SelectTab(int model_index,
|
void BrowserTabStripController::SelectTab(int model_index,
|
||||||
const ui::Event& event) {
|
const ui::Event& event) {
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> tracker =
|
std::unique_ptr<viz::PeakGpuMemoryTracker> tracker =
|
||||||
content::PeakGpuMemoryTrackerFactory::Create(
|
content::PeakGpuMemoryTrackerFactory::Create(
|
||||||
input::PeakGpuMemoryTracker::Usage::CHANGE_TAB);
|
viz::PeakGpuMemoryTracker::Usage::CHANGE_TAB);
|
||||||
|
|
||||||
TabStripUserGestureDetails gesture_detail(
|
TabStripUserGestureDetails gesture_detail(
|
||||||
TabStripUserGestureDetails::GestureType::kOther, event.time_stamp());
|
TabStripUserGestureDetails::GestureType::kOther, event.time_stamp());
|
||||||
@ -304,7 +304,7 @@ void BrowserTabStripController::SelectTab(int model_index,
|
|||||||
tabstrip_->GetWidget()
|
tabstrip_->GetWidget()
|
||||||
->GetCompositor()
|
->GetCompositor()
|
||||||
->RequestSuccessfulPresentationTimeForNextFrame(base::BindOnce(
|
->RequestSuccessfulPresentationTimeForNextFrame(base::BindOnce(
|
||||||
[](std::unique_ptr<input::PeakGpuMemoryTracker> tracker,
|
[](std::unique_ptr<viz::PeakGpuMemoryTracker> tracker,
|
||||||
const viz::FrameTimingDetails& frame_timing_details) {
|
const viz::FrameTimingDetails& frame_timing_details) {
|
||||||
// This callback will be ran once the ui::Compositor presents the
|
// This callback will be ran once the ui::Compositor presents the
|
||||||
// next frame for the |tabstrip_|. The destruction of |tracker| will
|
// next frame for the |tabstrip_|. The destruction of |tracker| will
|
||||||
|
@ -44,7 +44,6 @@ component("input") {
|
|||||||
"native_web_keyboard_event.h",
|
"native_web_keyboard_event.h",
|
||||||
"passthrough_touch_event_queue.cc",
|
"passthrough_touch_event_queue.cc",
|
||||||
"passthrough_touch_event_queue.h",
|
"passthrough_touch_event_queue.h",
|
||||||
"peak_gpu_memory_tracker.h",
|
|
||||||
"render_input_router.cc",
|
"render_input_router.cc",
|
||||||
"render_input_router.h",
|
"render_input_router.h",
|
||||||
"render_input_router_client.h",
|
"render_input_router_client.h",
|
||||||
|
@ -369,7 +369,7 @@ void RenderInputRouter::ForwardGestureEventWithLatencyInfo(
|
|||||||
|
|
||||||
if (gesture_event.GetType() == WebInputEvent::Type::kGestureScrollBegin) {
|
if (gesture_event.GetType() == WebInputEvent::Type::kGestureScrollBegin) {
|
||||||
scroll_peak_gpu_mem_tracker_ = delegate_->MakePeakGpuMemoryTracker(
|
scroll_peak_gpu_mem_tracker_ = delegate_->MakePeakGpuMemoryTracker(
|
||||||
input::PeakGpuMemoryTracker::Usage::SCROLL);
|
viz::PeakGpuMemoryTracker::Usage::SCROLL);
|
||||||
} else if (gesture_event.GetType() ==
|
} else if (gesture_event.GetType() ==
|
||||||
WebInputEvent::Type::kGestureScrollEnd) {
|
WebInputEvent::Type::kGestureScrollEnd) {
|
||||||
if (scroll_peak_gpu_mem_tracker_ && !is_currently_scrolling_viewport()) {
|
if (scroll_peak_gpu_mem_tracker_ && !is_currently_scrolling_viewport()) {
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
#include "components/input/fling_scheduler_base.h"
|
#include "components/input/fling_scheduler_base.h"
|
||||||
#include "components/input/input_disposition_handler.h"
|
#include "components/input/input_disposition_handler.h"
|
||||||
#include "components/input/input_router_impl.h"
|
#include "components/input/input_router_impl.h"
|
||||||
#include "components/input/peak_gpu_memory_tracker.h"
|
|
||||||
#include "components/input/render_input_router_delegate.h"
|
#include "components/input/render_input_router_delegate.h"
|
||||||
#include "components/input/render_input_router_iterator.h"
|
#include "components/input/render_input_router_iterator.h"
|
||||||
#include "components/input/render_input_router_latency_tracker.h"
|
#include "components/input/render_input_router_latency_tracker.h"
|
||||||
|
#include "components/viz/common/resources/peak_gpu_memory_tracker.h"
|
||||||
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
||||||
#include "mojo/public/cpp/bindings/associated_remote.h"
|
#include "mojo/public/cpp/bindings/associated_remote.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
@ -216,7 +216,7 @@ class COMPONENT_EXPORT(INPUT) RenderInputRouter
|
|||||||
bool is_in_touchpad_gesture_fling_ = false;
|
bool is_in_touchpad_gesture_fling_ = false;
|
||||||
std::unique_ptr<RenderInputRouterLatencyTracker> latency_tracker_;
|
std::unique_ptr<RenderInputRouterLatencyTracker> latency_tracker_;
|
||||||
|
|
||||||
std::unique_ptr<PeakGpuMemoryTracker> scroll_peak_gpu_mem_tracker_;
|
std::unique_ptr<viz::PeakGpuMemoryTracker> scroll_peak_gpu_mem_tracker_;
|
||||||
|
|
||||||
raw_ptr<RenderInputRouterClient> render_input_router_client_;
|
raw_ptr<RenderInputRouterClient> render_input_router_client_;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "cc/trees/render_frame_metadata.h"
|
#include "cc/trees/render_frame_metadata.h"
|
||||||
#include "components/input/peak_gpu_memory_tracker.h"
|
#include "components/viz/common/resources/peak_gpu_memory_tracker.h"
|
||||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||||
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
|
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
|
||||||
#include "ui/gfx/delegated_ink_point.h"
|
#include "ui/gfx/delegated_ink_point.h"
|
||||||
@ -62,8 +62,8 @@ class COMPONENT_EXPORT(INPUT) RenderInputRouterDelegate {
|
|||||||
// creation of a TouchEmulator.
|
// creation of a TouchEmulator.
|
||||||
virtual TouchEmulator* GetTouchEmulator(bool create_if_necessary) = 0;
|
virtual TouchEmulator* GetTouchEmulator(bool create_if_necessary) = 0;
|
||||||
|
|
||||||
virtual std::unique_ptr<input::PeakGpuMemoryTracker> MakePeakGpuMemoryTracker(
|
virtual std::unique_ptr<viz::PeakGpuMemoryTracker> MakePeakGpuMemoryTracker(
|
||||||
input::PeakGpuMemoryTracker::Usage usage) = 0;
|
viz::PeakGpuMemoryTracker::Usage usage) = 0;
|
||||||
|
|
||||||
// Called upon event ack receipt from the renderer.
|
// Called upon event ack receipt from the renderer.
|
||||||
virtual void OnWheelEventAck(
|
virtual void OnWheelEventAck(
|
||||||
|
@ -225,6 +225,9 @@ viz_component("common") {
|
|||||||
"quads/video_hole_draw_quad.h",
|
"quads/video_hole_draw_quad.h",
|
||||||
"resources/bitmap_allocation.cc",
|
"resources/bitmap_allocation.cc",
|
||||||
"resources/bitmap_allocation.h",
|
"resources/bitmap_allocation.h",
|
||||||
|
"resources/peak_gpu_memory_callback.cc",
|
||||||
|
"resources/peak_gpu_memory_callback.h",
|
||||||
|
"resources/peak_gpu_memory_tracker.h",
|
||||||
"resources/platform_color.h",
|
"resources/platform_color.h",
|
||||||
"resources/release_callback.h",
|
"resources/release_callback.h",
|
||||||
"resources/resource_id.cc",
|
"resources/resource_id.cc",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#pragma allow_unsafe_buffers
|
#pragma allow_unsafe_buffers
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "content/common/peak_gpu_memory_callback.h"
|
#include "components/viz/common/resources/peak_gpu_memory_callback.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -17,14 +17,14 @@
|
|||||||
#include "base/metrics/histogram_macros.h"
|
#include "base/metrics/histogram_macros.h"
|
||||||
#include "base/strings/strcat.h"
|
#include "base/strings/strcat.h"
|
||||||
|
|
||||||
namespace content {
|
namespace viz {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// These count values should be recalculated in case of changes to the number
|
// These count values should be recalculated in case of changes to the number
|
||||||
// of values in their respective enums.
|
// of values in their respective enums.
|
||||||
constexpr int kUsageTypeCount =
|
constexpr int kUsageTypeCount =
|
||||||
static_cast<int>(input::PeakGpuMemoryTracker::Usage::USAGE_MAX) + 1;
|
static_cast<int>(PeakGpuMemoryTracker::Usage::USAGE_MAX) + 1;
|
||||||
constexpr int kAllocationSourceTypeCount =
|
constexpr int kAllocationSourceTypeCount =
|
||||||
static_cast<int>(gpu::GpuPeakMemoryAllocationSource::
|
static_cast<int>(gpu::GpuPeakMemoryAllocationSource::
|
||||||
GPU_PEAK_MEMORY_ALLOCATION_SOURCE_MAX) +
|
GPU_PEAK_MEMORY_ALLOCATION_SOURCE_MAX) +
|
||||||
@ -39,13 +39,13 @@ constexpr int kMemoryHistogramMin = 1;
|
|||||||
constexpr int kMemoryHistogramMax = 64000;
|
constexpr int kMemoryHistogramMax = 64000;
|
||||||
constexpr int kMemoryHistogramBucketCount = 100;
|
constexpr int kMemoryHistogramBucketCount = 100;
|
||||||
|
|
||||||
constexpr const char* GetUsageName(input::PeakGpuMemoryTracker::Usage usage) {
|
constexpr const char* GetUsageName(PeakGpuMemoryTracker::Usage usage) {
|
||||||
switch (usage) {
|
switch (usage) {
|
||||||
case input::PeakGpuMemoryTracker::Usage::CHANGE_TAB:
|
case PeakGpuMemoryTracker::Usage::CHANGE_TAB:
|
||||||
return "ChangeTab2";
|
return "ChangeTab2";
|
||||||
case input::PeakGpuMemoryTracker::Usage::PAGE_LOAD:
|
case PeakGpuMemoryTracker::Usage::PAGE_LOAD:
|
||||||
return "PageLoad";
|
return "PageLoad";
|
||||||
case input::PeakGpuMemoryTracker::Usage::SCROLL:
|
case PeakGpuMemoryTracker::Usage::SCROLL:
|
||||||
return "Scroll";
|
return "Scroll";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,13 +66,12 @@ constexpr const char* GetAllocationSourceName(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetPeakMemoryUsageUMAName(
|
std::string GetPeakMemoryUsageUMAName(PeakGpuMemoryTracker::Usage usage) {
|
||||||
input::PeakGpuMemoryTracker::Usage usage) {
|
|
||||||
return base::StrCat({"Memory.GPU.PeakMemoryUsage2.", GetUsageName(usage)});
|
return base::StrCat({"Memory.GPU.PeakMemoryUsage2.", GetUsageName(usage)});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetPeakMemoryAllocationSourceUMAName(
|
std::string GetPeakMemoryAllocationSourceUMAName(
|
||||||
input::PeakGpuMemoryTracker::Usage usage,
|
PeakGpuMemoryTracker::Usage usage,
|
||||||
gpu::GpuPeakMemoryAllocationSource source) {
|
gpu::GpuPeakMemoryAllocationSource source) {
|
||||||
return base::StrCat({"Memory.GPU.PeakMemoryAllocationSource2.",
|
return base::StrCat({"Memory.GPU.PeakMemoryAllocationSource2.",
|
||||||
GetUsageName(usage), ".",
|
GetUsageName(usage), ".",
|
||||||
@ -86,7 +85,7 @@ std::string GetPeakMemoryAllocationSourceUMAName(
|
|||||||
// requested |usage|. Some tests may provide an optional |testing_callback| in
|
// requested |usage|. Some tests may provide an optional |testing_callback| in
|
||||||
// order to sync tests with the work done here on the UI thread.
|
// order to sync tests with the work done here on the UI thread.
|
||||||
void PeakGpuMemoryCallback(
|
void PeakGpuMemoryCallback(
|
||||||
input::PeakGpuMemoryTracker::Usage usage,
|
PeakGpuMemoryTracker::Usage usage,
|
||||||
base::OnceClosure testing_callback,
|
base::OnceClosure testing_callback,
|
||||||
const uint64_t peak_memory,
|
const uint64_t peak_memory,
|
||||||
const base::flat_map<gpu::GpuPeakMemoryAllocationSource, uint64_t>&
|
const base::flat_map<gpu::GpuPeakMemoryAllocationSource, uint64_t>&
|
||||||
@ -117,4 +116,4 @@ void PeakGpuMemoryCallback(
|
|||||||
std::move(testing_callback).Run();
|
std::move(testing_callback).Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace content
|
} // namespace viz
|
@ -2,15 +2,16 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CONTENT_COMMON_PEAK_GPU_MEMORY_CALLBACK_H_
|
#ifndef COMPONENTS_VIZ_COMMON_RESOURCES_PEAK_GPU_MEMORY_CALLBACK_H_
|
||||||
#define CONTENT_COMMON_PEAK_GPU_MEMORY_CALLBACK_H_
|
#define COMPONENTS_VIZ_COMMON_RESOURCES_PEAK_GPU_MEMORY_CALLBACK_H_
|
||||||
|
|
||||||
#include "base/containers/flat_map.h"
|
#include "base/containers/flat_map.h"
|
||||||
#include "base/functional/callback_forward.h"
|
#include "base/functional/callback_forward.h"
|
||||||
#include "components/input/peak_gpu_memory_tracker.h"
|
#include "components/viz/common/resources/peak_gpu_memory_tracker.h"
|
||||||
|
#include "components/viz/common/viz_common_export.h"
|
||||||
#include "gpu/ipc/common/gpu_peak_memory.h"
|
#include "gpu/ipc/common/gpu_peak_memory.h"
|
||||||
|
|
||||||
namespace content {
|
namespace viz {
|
||||||
|
|
||||||
// Callback provided to the GpuService, which will be notified of the
|
// Callback provided to the GpuService, which will be notified of the
|
||||||
// |peak_memory| used since GpuService started tracking GPU memory.
|
// |peak_memory| used since GpuService started tracking GPU memory.
|
||||||
@ -25,12 +26,12 @@ namespace content {
|
|||||||
// - |peak_memory|: The total peak GPU memory usage in bytes.
|
// - |peak_memory|: The total peak GPU memory usage in bytes.
|
||||||
// - |allocation_per_source|: A breakdown of the peak memory usage, showing how
|
// - |allocation_per_source|: A breakdown of the peak memory usage, showing how
|
||||||
// much was allocated by each source.
|
// much was allocated by each source.
|
||||||
void PeakGpuMemoryCallback(
|
void VIZ_COMMON_EXPORT PeakGpuMemoryCallback(
|
||||||
input::PeakGpuMemoryTracker::Usage usage,
|
PeakGpuMemoryTracker::Usage usage,
|
||||||
base::OnceClosure testing_callback,
|
base::OnceClosure testing_callback,
|
||||||
const uint64_t peak_memory,
|
const uint64_t peak_memory,
|
||||||
const base::flat_map<gpu::GpuPeakMemoryAllocationSource, uint64_t>&
|
const base::flat_map<gpu::GpuPeakMemoryAllocationSource, uint64_t>&
|
||||||
allocation_per_source);
|
allocation_per_source);
|
||||||
} // namespace content
|
} // namespace viz
|
||||||
|
|
||||||
#endif // CONTENT_COMMON_PEAK_GPU_MEMORY_CALLBACK_H_
|
#endif // COMPONENTS_VIZ_COMMON_RESOURCES_PEAK_GPU_MEMORY_CALLBACK_H_
|
@ -2,12 +2,12 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef COMPONENTS_INPUT_PEAK_GPU_MEMORY_TRACKER_H_
|
#ifndef COMPONENTS_VIZ_COMMON_RESOURCES_PEAK_GPU_MEMORY_TRACKER_H_
|
||||||
#define COMPONENTS_INPUT_PEAK_GPU_MEMORY_TRACKER_H_
|
#define COMPONENTS_VIZ_COMMON_RESOURCES_PEAK_GPU_MEMORY_TRACKER_H_
|
||||||
|
|
||||||
#include "base/component_export.h"
|
#include "components/viz/common/viz_common_export.h"
|
||||||
|
|
||||||
namespace input {
|
namespace viz {
|
||||||
|
|
||||||
// Tracks the peak memory of the GPU service for its lifetime. Upon its
|
// Tracks the peak memory of the GPU service for its lifetime. Upon its
|
||||||
// destruction a report will be requested from the GPU service. The peak will be
|
// destruction a report will be requested from the GPU service. The peak will be
|
||||||
@ -20,7 +20,7 @@ namespace input {
|
|||||||
// See `content::PeakGpuMemoryTrackerFactory::Create` for creation of
|
// See `content::PeakGpuMemoryTrackerFactory::Create` for creation of
|
||||||
// PeakGpuMemoryTracker in the browser process.
|
// PeakGpuMemoryTracker in the browser process.
|
||||||
|
|
||||||
class COMPONENT_EXPORT(INPUT) PeakGpuMemoryTracker {
|
class VIZ_COMMON_EXPORT PeakGpuMemoryTracker {
|
||||||
public:
|
public:
|
||||||
// The type of user interaction, for which the GPU Peak Memory Usage is being
|
// The type of user interaction, for which the GPU Peak Memory Usage is being
|
||||||
// observed.
|
// observed.
|
||||||
@ -37,6 +37,6 @@ class COMPONENT_EXPORT(INPUT) PeakGpuMemoryTracker {
|
|||||||
virtual void Cancel() = 0;
|
virtual void Cancel() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace input
|
} // namespace viz
|
||||||
|
|
||||||
#endif // COMPONENTS_INPUT_PEAK_GPU_MEMORY_TRACKER_H_
|
#endif // COMPONENTS_VIZ_COMMON_RESOURCES_PEAK_GPU_MEMORY_TRACKER_H_
|
@ -123,9 +123,9 @@ void RenderInputRouterDelegateImpl::OnInvalidInputEventSource() {
|
|||||||
delegate_->OnInvalidInputEventSource(frame_sink_id_, grouping_id_);
|
delegate_->OnInvalidInputEventSource(frame_sink_id_, grouping_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker>
|
std::unique_ptr<PeakGpuMemoryTracker>
|
||||||
RenderInputRouterDelegateImpl::MakePeakGpuMemoryTracker(
|
RenderInputRouterDelegateImpl::MakePeakGpuMemoryTracker(
|
||||||
input::PeakGpuMemoryTracker::Usage usage) {
|
PeakGpuMemoryTracker::Usage usage) {
|
||||||
// TODO(b/365541296): Implement RenderInputRouterDelegate interface in Viz.
|
// TODO(b/365541296): Implement RenderInputRouterDelegate interface in Viz.
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
#include "base/memory/scoped_refptr.h"
|
#include "base/memory/scoped_refptr.h"
|
||||||
#include "components/input/event_with_latency_info.h"
|
#include "components/input/event_with_latency_info.h"
|
||||||
#include "components/input/peak_gpu_memory_tracker.h"
|
|
||||||
#include "components/input/render_input_router_delegate.h"
|
#include "components/input/render_input_router_delegate.h"
|
||||||
#include "components/input/render_input_router_iterator.h"
|
#include "components/input/render_input_router_iterator.h"
|
||||||
|
#include "components/viz/common/resources/peak_gpu_memory_tracker.h"
|
||||||
#include "components/viz/common/surfaces/frame_sink_id.h"
|
#include "components/viz/common/surfaces/frame_sink_id.h"
|
||||||
#include "components/viz/service/viz_service_export.h"
|
#include "components/viz/service/viz_service_export.h"
|
||||||
#include "third_party/blink/public/common/input/web_coalesced_input_event.h"
|
#include "third_party/blink/public/common/input/web_coalesced_input_event.h"
|
||||||
@ -75,8 +75,8 @@ class VIZ_SERVICE_EXPORT RenderInputRouterDelegateImpl
|
|||||||
blink::mojom::InputEventResultState ack_result,
|
blink::mojom::InputEventResultState ack_result,
|
||||||
const blink::WebInputEvent& event) override;
|
const blink::WebInputEvent& event) override;
|
||||||
input::TouchEmulator* GetTouchEmulator(bool create_if_necessary) override;
|
input::TouchEmulator* GetTouchEmulator(bool create_if_necessary) override;
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> MakePeakGpuMemoryTracker(
|
std::unique_ptr<PeakGpuMemoryTracker> MakePeakGpuMemoryTracker(
|
||||||
input::PeakGpuMemoryTracker::Usage usage) override;
|
PeakGpuMemoryTracker::Usage usage) override;
|
||||||
void OnWheelEventAck(
|
void OnWheelEventAck(
|
||||||
const input::MouseWheelEventWithLatencyInfo& event,
|
const input::MouseWheelEventWithLatencyInfo& event,
|
||||||
blink::mojom::InputEventResultSource ack_source,
|
blink::mojom::InputEventResultSource ack_source,
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/containers/flat_map.h"
|
#include "base/containers/flat_map.h"
|
||||||
|
#include "components/viz/common/resources/peak_gpu_memory_callback.h"
|
||||||
#include "content/browser/gpu/gpu_process_host.h"
|
#include "content/browser/gpu/gpu_process_host.h"
|
||||||
#include "content/common/peak_gpu_memory_callback.h"
|
|
||||||
#include "content/public/browser/gpu_data_manager.h"
|
#include "content/public/browser/gpu_data_manager.h"
|
||||||
#include "content/public/browser/peak_gpu_memory_tracker_factory.h"
|
#include "content/public/browser/peak_gpu_memory_tracker_factory.h"
|
||||||
#include "services/viz/privileged/mojom/gl/gpu_service.mojom.h"
|
#include "services/viz/privileged/mojom/gl/gpu_service.mojom.h"
|
||||||
@ -16,8 +16,8 @@
|
|||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker>
|
std::unique_ptr<viz::PeakGpuMemoryTracker> PeakGpuMemoryTrackerFactory::Create(
|
||||||
PeakGpuMemoryTrackerFactory::Create(input::PeakGpuMemoryTracker::Usage usage) {
|
viz::PeakGpuMemoryTracker::Usage usage) {
|
||||||
return std::make_unique<PeakGpuMemoryTrackerImpl>(usage);
|
return std::make_unique<PeakGpuMemoryTrackerImpl>(usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ PeakGpuMemoryTrackerFactory::Create(input::PeakGpuMemoryTracker::Usage usage) {
|
|||||||
uint32_t PeakGpuMemoryTrackerImpl::next_sequence_number_ = 0;
|
uint32_t PeakGpuMemoryTrackerImpl::next_sequence_number_ = 0;
|
||||||
|
|
||||||
PeakGpuMemoryTrackerImpl::PeakGpuMemoryTrackerImpl(
|
PeakGpuMemoryTrackerImpl::PeakGpuMemoryTrackerImpl(
|
||||||
input::PeakGpuMemoryTracker::Usage usage)
|
viz::PeakGpuMemoryTracker::Usage usage)
|
||||||
: usage_(usage) {
|
: usage_(usage) {
|
||||||
// Actually performs request to GPU service to begin memory tracking for
|
// Actually performs request to GPU service to begin memory tracking for
|
||||||
// |sequence_number_|.
|
// |sequence_number_|.
|
||||||
@ -59,7 +59,7 @@ PeakGpuMemoryTrackerImpl::~PeakGpuMemoryTrackerImpl() {
|
|||||||
if (auto* gpu_service = host->gpu_service()) {
|
if (auto* gpu_service = host->gpu_service()) {
|
||||||
gpu_service->GetPeakMemoryUsage(
|
gpu_service->GetPeakMemoryUsage(
|
||||||
sequence_num_,
|
sequence_num_,
|
||||||
base::BindOnce(&PeakGpuMemoryCallback, usage_,
|
base::BindOnce(&viz::PeakGpuMemoryCallback, usage_,
|
||||||
std::move(post_gpu_service_callback_for_testing_)));
|
std::move(post_gpu_service_callback_for_testing_)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "base/functional/callback_forward.h"
|
#include "base/functional/callback_forward.h"
|
||||||
#include "base/functional/callback_helpers.h"
|
#include "base/functional/callback_helpers.h"
|
||||||
#include "base/task/single_thread_task_runner.h"
|
#include "base/task/single_thread_task_runner.h"
|
||||||
#include "components/input/peak_gpu_memory_tracker.h"
|
#include "components/viz/common/resources/peak_gpu_memory_tracker.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
@ -20,11 +20,11 @@ namespace content {
|
|||||||
// be no report to UMA Histograms. The same for if there is never a successful
|
// be no report to UMA Histograms. The same for if there is never a successful
|
||||||
// GPU connection.
|
// GPU connection.
|
||||||
//
|
//
|
||||||
// This is instaniated via `PeakGpuMemoryTrackerFactory::Create`.
|
// This is instantiated via `PeakGpuMemoryTrackerFactory::Create`.
|
||||||
class PeakGpuMemoryTrackerImpl : public input::PeakGpuMemoryTracker {
|
class PeakGpuMemoryTrackerImpl : public viz::PeakGpuMemoryTracker {
|
||||||
public:
|
public:
|
||||||
// Requests the GPU service to begin peak memory tracking.
|
// Requests the GPU service to begin peak memory tracking.
|
||||||
PeakGpuMemoryTrackerImpl(input::PeakGpuMemoryTracker::Usage usage);
|
PeakGpuMemoryTrackerImpl(viz::PeakGpuMemoryTracker::Usage usage);
|
||||||
// Requests the GPU service provides the peak memory, the result is presented
|
// Requests the GPU service provides the peak memory, the result is presented
|
||||||
// to UMA Histograms.
|
// to UMA Histograms.
|
||||||
~PeakGpuMemoryTrackerImpl() override;
|
~PeakGpuMemoryTrackerImpl() override;
|
||||||
@ -45,7 +45,7 @@ class PeakGpuMemoryTrackerImpl : public input::PeakGpuMemoryTracker {
|
|||||||
static uint32_t next_sequence_number_;
|
static uint32_t next_sequence_number_;
|
||||||
|
|
||||||
bool canceled_ = false;
|
bool canceled_ = false;
|
||||||
input::PeakGpuMemoryTracker::Usage usage_;
|
viz::PeakGpuMemoryTracker::Usage usage_;
|
||||||
uint32_t sequence_num_ = next_sequence_number_++;
|
uint32_t sequence_num_ = next_sequence_number_++;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ class PeakGpuMemoryTrackerImplTest : public ContentBrowserTest {
|
|||||||
std::move(receiver));
|
std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTestingCallback(input::PeakGpuMemoryTracker* tracker,
|
void SetTestingCallback(viz::PeakGpuMemoryTracker* tracker,
|
||||||
base::OnceClosure callback) {
|
base::OnceClosure callback) {
|
||||||
static_cast<PeakGpuMemoryTrackerImpl*>(tracker)
|
static_cast<PeakGpuMemoryTrackerImpl*>(tracker)
|
||||||
->post_gpu_service_callback_for_testing_ = std::move(callback);
|
->post_gpu_service_callback_for_testing_ = std::move(callback);
|
||||||
@ -272,9 +272,9 @@ class PeakGpuMemoryTrackerImplTest : public ContentBrowserTest {
|
|||||||
IN_PROC_BROWSER_TEST_F(PeakGpuMemoryTrackerImplTest, PeakGpuMemoryCallback) {
|
IN_PROC_BROWSER_TEST_F(PeakGpuMemoryTrackerImplTest, PeakGpuMemoryCallback) {
|
||||||
base::HistogramTester histogram;
|
base::HistogramTester histogram;
|
||||||
base::RunLoop run_loop;
|
base::RunLoop run_loop;
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> tracker =
|
std::unique_ptr<viz::PeakGpuMemoryTracker> tracker =
|
||||||
PeakGpuMemoryTrackerFactory::Create(
|
PeakGpuMemoryTrackerFactory::Create(
|
||||||
input::PeakGpuMemoryTracker::Usage::PAGE_LOAD);
|
viz::PeakGpuMemoryTracker::Usage::PAGE_LOAD);
|
||||||
SetTestingCallback(tracker.get(), run_loop.QuitClosure());
|
SetTestingCallback(tracker.get(), run_loop.QuitClosure());
|
||||||
FlushRemoteForTesting();
|
FlushRemoteForTesting();
|
||||||
// No report in response to creation.
|
// No report in response to creation.
|
||||||
|
@ -1795,7 +1795,7 @@ NavigationRequest::NavigationRequest(
|
|||||||
|
|
||||||
if (IsInPrimaryMainFrame()) {
|
if (IsInPrimaryMainFrame()) {
|
||||||
loading_mem_tracker_ = PeakGpuMemoryTrackerFactory::Create(
|
loading_mem_tracker_ = PeakGpuMemoryTrackerFactory::Create(
|
||||||
input::PeakGpuMemoryTracker::Usage::PAGE_LOAD);
|
viz::PeakGpuMemoryTracker::Usage::PAGE_LOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame_tree_node_->IsInFencedFrameTree()) {
|
if (frame_tree_node_->IsInFencedFrameTree()) {
|
||||||
@ -9437,7 +9437,7 @@ bool NavigationRequest::CheckPermissionsPoliciesForFencedFrames(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker>
|
std::unique_ptr<viz::PeakGpuMemoryTracker>
|
||||||
NavigationRequest::TakePeakGpuMemoryTracker() {
|
NavigationRequest::TakePeakGpuMemoryTracker() {
|
||||||
return std::move(loading_mem_tracker_);
|
return std::move(loading_mem_tracker_);
|
||||||
}
|
}
|
||||||
|
@ -762,7 +762,7 @@ class CONTENT_EXPORT NavigationRequest
|
|||||||
// CreateForCommit().
|
// CreateForCommit().
|
||||||
bool IsNavigationStarted() const;
|
bool IsNavigationStarted() const;
|
||||||
|
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> TakePeakGpuMemoryTracker();
|
std::unique_ptr<viz::PeakGpuMemoryTracker> TakePeakGpuMemoryTracker();
|
||||||
|
|
||||||
std::unique_ptr<NavigationEarlyHintsManager> TakeEarlyHintsManager();
|
std::unique_ptr<NavigationEarlyHintsManager> TakeEarlyHintsManager();
|
||||||
|
|
||||||
@ -2513,7 +2513,7 @@ class CONTENT_EXPORT NavigationRequest
|
|||||||
|
|
||||||
std::unique_ptr<CrossOriginEmbedderPolicyReporter> coep_reporter_;
|
std::unique_ptr<CrossOriginEmbedderPolicyReporter> coep_reporter_;
|
||||||
|
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> loading_mem_tracker_;
|
std::unique_ptr<viz::PeakGpuMemoryTracker> loading_mem_tracker_;
|
||||||
|
|
||||||
// Structure tracking the effects of the CrossOriginOpenerPolicy on this
|
// Structure tracking the effects of the CrossOriginOpenerPolicy on this
|
||||||
// navigation.
|
// navigation.
|
||||||
|
@ -36,9 +36,9 @@ namespace cc {
|
|||||||
struct BrowserControlsOffsetTagsInfo;
|
struct BrowserControlsOffsetTagsInfo;
|
||||||
} // namespace cc
|
} // namespace cc
|
||||||
|
|
||||||
namespace input {
|
namespace viz {
|
||||||
class PeakGpuMemoryTracker;
|
class PeakGpuMemoryTracker;
|
||||||
} // namespace input
|
} // namespace viz
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ class CONTENT_EXPORT PageImpl : public Page {
|
|||||||
// Created by NavigationRequest; ownership is maintained until the frame has
|
// Created by NavigationRequest; ownership is maintained until the frame has
|
||||||
// stopped loading, or we navigate away from the page before it finishes
|
// stopped loading, or we navigate away from the page before it finishes
|
||||||
// loading.
|
// loading.
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> loading_memory_tracker_;
|
std::unique_ptr<viz::PeakGpuMemoryTracker> loading_memory_tracker_;
|
||||||
|
|
||||||
// Whether the page is overriding the user agent or not.
|
// Whether the page is overriding the user agent or not.
|
||||||
bool is_overriding_user_agent_ = false;
|
bool is_overriding_user_agent_ = false;
|
||||||
|
@ -2536,9 +2536,9 @@ bool RenderWidgetHostImpl::PreHandleGestureEvent(
|
|||||||
return delegate()->PreHandleGestureEvent(event);
|
return delegate()->PreHandleGestureEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker>
|
std::unique_ptr<viz::PeakGpuMemoryTracker>
|
||||||
RenderWidgetHostImpl::MakePeakGpuMemoryTracker(
|
RenderWidgetHostImpl::MakePeakGpuMemoryTracker(
|
||||||
input::PeakGpuMemoryTracker::Usage usage) {
|
viz::PeakGpuMemoryTracker::Usage usage) {
|
||||||
return PeakGpuMemoryTrackerFactory::Create(usage);
|
return PeakGpuMemoryTrackerFactory::Create(usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,8 +383,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
|||||||
const blink::WebInputEvent& event) override;
|
const blink::WebInputEvent& event) override;
|
||||||
bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override;
|
bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override;
|
||||||
TouchEmulatorImpl* GetTouchEmulator(bool create_if_necessary) override;
|
TouchEmulatorImpl* GetTouchEmulator(bool create_if_necessary) override;
|
||||||
std::unique_ptr<input::PeakGpuMemoryTracker> MakePeakGpuMemoryTracker(
|
std::unique_ptr<viz::PeakGpuMemoryTracker> MakePeakGpuMemoryTracker(
|
||||||
input::PeakGpuMemoryTracker::Usage usage) override;
|
viz::PeakGpuMemoryTracker::Usage usage) override;
|
||||||
void OnWheelEventAck(const input::MouseWheelEventWithLatencyInfo& event,
|
void OnWheelEventAck(const input::MouseWheelEventWithLatencyInfo& event,
|
||||||
blink::mojom::InputEventResultSource ack_source,
|
blink::mojom::InputEventResultSource ack_source,
|
||||||
blink::mojom::InputEventResultState ack_result) override;
|
blink::mojom::InputEventResultState ack_result) override;
|
||||||
|
@ -156,8 +156,6 @@ source_set("common") {
|
|||||||
"navigation_gesture.h",
|
"navigation_gesture.h",
|
||||||
"navigation_params_utils.h",
|
"navigation_params_utils.h",
|
||||||
"origin_util.cc",
|
"origin_util.cc",
|
||||||
"peak_gpu_memory_callback.cc",
|
|
||||||
"peak_gpu_memory_callback.h",
|
|
||||||
"process_type.cc",
|
"process_type.cc",
|
||||||
"process_visibility_tracker.cc",
|
"process_visibility_tracker.cc",
|
||||||
"process_visibility_tracker.h",
|
"process_visibility_tracker.h",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "components/input/peak_gpu_memory_tracker.h"
|
#include "components/viz/common/resources/peak_gpu_memory_tracker.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@ -25,8 +25,8 @@ class CONTENT_EXPORT PeakGpuMemoryTrackerFactory {
|
|||||||
// GPU service. Destroy the PeakGpuMemoryTracker to request a report from the
|
// GPU service. Destroy the PeakGpuMemoryTracker to request a report from the
|
||||||
// GPU service. The report will be recorded in UMA Histograms for the given
|
// GPU service. The report will be recorded in UMA Histograms for the given
|
||||||
// |usage| type.
|
// |usage| type.
|
||||||
static std::unique_ptr<input::PeakGpuMemoryTracker> Create(
|
static std::unique_ptr<viz::PeakGpuMemoryTracker> Create(
|
||||||
input::PeakGpuMemoryTracker::Usage usage);
|
viz::PeakGpuMemoryTracker::Usage usage);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace content
|
} // namespace content
|
||||||
|
Reference in New Issue
Block a user