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

Fix CompositorFrameSinkSupport::GetSurfaceSize().

Fix two issues with GetSurfaceSize(). First, the Surface could have been
evicted so check if |current_surface| is null. Second, simplify logic by
getting the size_in_pixels() from Surface::surface_info_ since it will
always be the same for active/fallback frame.

Bug: none
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: If38f0673c878ebaadba8ee7038b4f677a522bdbe
Reviewed-on: https://chromium-review.googlesource.com/783253Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518452}
parent 75ef3e36
...@@ -404,10 +404,8 @@ gfx::Size CompositorFrameSinkSupport::GetSurfaceSize() { ...@@ -404,10 +404,8 @@ gfx::Size CompositorFrameSinkSupport::GetSurfaceSize() {
if (current_surface_id_.is_valid()) { if (current_surface_id_.is_valid()) {
Surface* current_surface = Surface* current_surface =
surface_manager_->GetSurfaceForId(current_surface_id_); surface_manager_->GetSurfaceForId(current_surface_id_);
if (current_surface->HasActiveFrame()) if (current_surface)
return current_surface->GetActiveFrame().size_in_pixels(); return current_surface->size_in_pixels();
else if (current_surface->HasPendingFrame())
return current_surface->GetPendingFrame().size_in_pixels();
} }
return gfx::Size(); return gfx::Size();
} }
......
...@@ -93,6 +93,9 @@ class VIZ_SERVICE_EXPORT Surface final : public SurfaceDeadlineClient { ...@@ -93,6 +93,9 @@ class VIZ_SERVICE_EXPORT Surface final : public SurfaceDeadlineClient {
const SurfaceId& previous_frame_surface_id() const { const SurfaceId& previous_frame_surface_id() const {
return previous_frame_surface_id_; return previous_frame_surface_id_;
} }
const gfx::Size& size_in_pixels() const {
return surface_info_.size_in_pixels();
}
base::WeakPtr<SurfaceClient> client() { return surface_client_; } base::WeakPtr<SurfaceClient> client() { return surface_client_; }
......
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