| 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.
|
| }
|
|
|