| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( | 50 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( |
| 51 RenderWidgetHost* widget_host) | 51 RenderWidgetHost* widget_host) |
| 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 frame_connector_(nullptr), | 59 frame_connector_(nullptr), |
| 60 background_color_(SK_ColorWHITE), |
| 60 weak_factory_(this) { | 61 weak_factory_(this) { |
| 61 id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); | 62 id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); |
| 62 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 63 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 63 CreateCompositorFrameSinkSupport(); | 64 CreateCompositorFrameSinkSupport(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { | 67 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { |
| 67 ResetCompositorFrameSinkSupport(); | 68 ResetCompositorFrameSinkSupport(); |
| 68 if (GetSurfaceManager()) | 69 if (GetSurfaceManager()) |
| 69 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); | 70 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return nullptr; | 207 return nullptr; |
| 207 } | 208 } |
| 208 | 209 |
| 209 gfx::NativeViewAccessible | 210 gfx::NativeViewAccessible |
| 210 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() { | 211 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() { |
| 211 NOTREACHED(); | 212 NOTREACHED(); |
| 212 return nullptr; | 213 return nullptr; |
| 213 } | 214 } |
| 214 | 215 |
| 215 void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) { | 216 void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) { |
| 216 RenderWidgetHostViewBase::SetBackgroundColor(color); | 217 background_color_ = color; |
| 217 bool opaque = GetBackgroundOpaque(); | 218 |
| 218 host_->SetBackgroundOpaque(opaque); | 219 DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE || |
| 220 SkColorGetA(color) == SK_AlphaTRANSPARENT); |
| 221 host_->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE); |
| 222 } |
| 223 |
| 224 SkColor RenderWidgetHostViewChildFrame::background_color() const { |
| 225 return background_color_; |
| 219 } | 226 } |
| 220 | 227 |
| 221 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const { | 228 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const { |
| 222 gfx::Size size; | 229 gfx::Size size; |
| 223 if (frame_connector_) { | 230 if (frame_connector_) { |
| 224 content::ScreenInfo screen_info; | 231 content::ScreenInfo screen_info; |
| 225 host_->GetScreenInfo(&screen_info); | 232 host_->GetScreenInfo(&screen_info); |
| 226 size = gfx::ScaleToCeiledSize(frame_connector_->ChildFrameRect().size(), | 233 size = gfx::ScaleToCeiledSize(frame_connector_->ChildFrameRect().size(), |
| 227 screen_info.device_scale_factor); | 234 screen_info.device_scale_factor); |
| 228 } | 235 } |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 if (!support_) | 725 if (!support_) |
| 719 return; | 726 return; |
| 720 if (parent_frame_sink_id_.is_valid()) { | 727 if (parent_frame_sink_id_.is_valid()) { |
| 721 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, | 728 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, |
| 722 frame_sink_id_); | 729 frame_sink_id_); |
| 723 } | 730 } |
| 724 support_.reset(); | 731 support_.reset(); |
| 725 } | 732 } |
| 726 | 733 |
| 727 } // namespace content | 734 } // namespace content |
| OLD | NEW |