| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 : host_(RenderWidgetHostImpl::From(widget_host)), | 52 : host_(RenderWidgetHostImpl::From(widget_host)), |
| 53 frame_sink_id_( | 53 frame_sink_id_( |
| 54 base::checked_cast<uint32_t>(widget_host->GetProcess()->GetID()), | 54 base::checked_cast<uint32_t>(widget_host->GetProcess()->GetID()), |
| 55 base::checked_cast<uint32_t>(widget_host->GetRoutingID())), | 55 base::checked_cast<uint32_t>(widget_host->GetRoutingID())), |
| 56 next_surface_sequence_(1u), | 56 next_surface_sequence_(1u), |
| 57 last_compositor_frame_sink_id_(0), | 57 last_compositor_frame_sink_id_(0), |
| 58 current_surface_scale_factor_(1.f), | 58 current_surface_scale_factor_(1.f), |
| 59 ack_pending_count_(0), | 59 ack_pending_count_(0), |
| 60 frame_connector_(nullptr), | 60 frame_connector_(nullptr), |
| 61 begin_frame_source_(nullptr), | 61 begin_frame_source_(nullptr), |
| 62 background_color_(SK_ColorWHITE), |
| 62 weak_factory_(this) { | 63 weak_factory_(this) { |
| 63 id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); | 64 id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); |
| 64 auto* manager = GetSurfaceManager(); | 65 auto* manager = GetSurfaceManager(); |
| 65 manager->RegisterFrameSinkId(frame_sink_id_); | 66 manager->RegisterFrameSinkId(frame_sink_id_); |
| 66 surface_factory_ = | 67 surface_factory_ = |
| 67 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); | 68 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); |
| 68 } | 69 } |
| 69 | 70 |
| 70 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { | 71 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { |
| 71 surface_factory_->EvictSurface(); | 72 surface_factory_->EvictSurface(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return nullptr; | 220 return nullptr; |
| 220 } | 221 } |
| 221 | 222 |
| 222 gfx::NativeViewAccessible | 223 gfx::NativeViewAccessible |
| 223 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() { | 224 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() { |
| 224 NOTREACHED(); | 225 NOTREACHED(); |
| 225 return nullptr; | 226 return nullptr; |
| 226 } | 227 } |
| 227 | 228 |
| 228 void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) { | 229 void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) { |
| 229 RenderWidgetHostViewBase::SetBackgroundColor(color); | 230 background_color_ = color; |
| 230 bool opaque = GetBackgroundOpaque(); | 231 |
| 231 host_->SetBackgroundOpaque(opaque); | 232 DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE || |
| 233 SkColorGetA(color) == SK_AlphaTRANSPARENT); |
| 234 host_->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE); |
| 235 } |
| 236 |
| 237 SkColor RenderWidgetHostViewChildFrame::background_color() const { |
| 238 return background_color_; |
| 232 } | 239 } |
| 233 | 240 |
| 234 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const { | 241 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const { |
| 235 gfx::Size size; | 242 gfx::Size size; |
| 236 if (frame_connector_) { | 243 if (frame_connector_) { |
| 237 content::ScreenInfo screen_info; | 244 content::ScreenInfo screen_info; |
| 238 host_->GetScreenInfo(&screen_info); | 245 host_->GetScreenInfo(&screen_info); |
| 239 size = gfx::ScaleToCeiledSize(frame_connector_->ChildFrameRect().size(), | 246 size = gfx::ScaleToCeiledSize(frame_connector_->ChildFrameRect().size(), |
| 240 screen_info.device_scale_factor); | 247 screen_info.device_scale_factor); |
| 241 } | 248 } |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 | 755 |
| 749 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 756 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 750 return true; | 757 return true; |
| 751 } | 758 } |
| 752 | 759 |
| 753 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 760 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 754 return cc::SurfaceId(frame_sink_id_, local_surface_id_); | 761 return cc::SurfaceId(frame_sink_id_, local_surface_id_); |
| 755 }; | 762 }; |
| 756 | 763 |
| 757 } // namespace content | 764 } // namespace content |
| OLD | NEW |