Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 2144733005: [WIP] cc: Plumb SurfaceId from clients Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure only SurfaceFactoy and tests can update hierarchy Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.h ('k') | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/compositor_output_surface.cc
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index f341e25fbb002293ed6464c8911c4934f0b20400..7551a8cbff19274e7cab858c2cef679e81bb424b 100644
--- a/content/renderer/gpu/compositor_output_surface.cc
+++ b/content/renderer/gpu/compositor_output_surface.cc
@@ -23,6 +23,7 @@
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
#include "ipc/ipc_sync_channel.h"
+#include "ui/gfx/geometry/dip_util.h"
namespace content {
@@ -40,6 +41,8 @@ CompositorOutputSurface::CompositorOutputSurface(
RenderThreadImpl::current()->compositor_message_filter()),
message_sender_(RenderThreadImpl::current()->sync_message_filter()),
frame_swap_message_queue_(swap_frame_message_queue),
+ allocator_(0),
+ current_scale_factor_(1.f),
routing_id_(routing_id) {
DCHECK(output_surface_filter_);
DCHECK(frame_swap_message_queue_);
@@ -58,6 +61,8 @@ CompositorOutputSurface::CompositorOutputSurface(
RenderThreadImpl::current()->compositor_message_filter()),
message_sender_(RenderThreadImpl::current()->sync_message_filter()),
frame_swap_message_queue_(swap_frame_message_queue),
+ allocator_(0),
+ current_scale_factor_(1.f),
routing_id_(routing_id) {
DCHECK(output_surface_filter_);
DCHECK(frame_swap_message_queue_);
@@ -103,6 +108,20 @@ void CompositorOutputSurface::DetachFromClient() {
}
void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
+ cc::RenderPass* root_pass =
+ frame.delegated_frame_data->render_pass_list.back().get();
+ float frame_device_scale_factor = frame.metadata.device_scale_factor;
+ gfx::Size frame_size = root_pass->output_rect.size();
+ gfx::Size frame_size_in_dip =
+ gfx::ConvertSizeToDIP(frame_device_scale_factor, frame_size);
+ if (surface_id_.is_null() || frame_size != current_surface_size_ ||
+ frame_size_in_dip != current_surface_size_in_dip_) {
+ surface_id_ = allocator_.GenerateId();
+ current_surface_size_ = frame_size;
+ current_surface_size_in_dip_ = frame_size_in_dip;
+ current_scale_factor_ = frame_device_scale_factor;
+ }
+
{
std::unique_ptr<FrameSwapMessageQueue::SendMessageScope>
send_message_scope =
@@ -113,7 +132,7 @@ void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
FrameSwapMessageQueue::TransferMessages(&messages,
&messages_to_deliver_with_frame);
Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, output_surface_id_,
- frame,
+ surface_id_, frame,
messages_to_deliver_with_frame));
// ~send_message_scope.
}
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.h ('k') | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698