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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2684933003: Move frame_sink_id management to framesink_manager.cc/h from (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 weak_factory_(this) { 62 weak_factory_(this) {
63 id_allocator_.reset(new cc::SurfaceIdAllocator()); 63 id_allocator_.reset(new cc::SurfaceIdAllocator());
64 auto* framesink_manager = GetFrameSinkManager();
64 auto* manager = GetSurfaceManager(); 65 auto* manager = GetSurfaceManager();
65 manager->RegisterFrameSinkId(frame_sink_id_); 66 framesink_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();
72 if (GetSurfaceManager()) 73 if (GetFrameSinkManager())
73 GetSurfaceManager()->InvalidateFrameSinkId(frame_sink_id_); 74 GetFrameSinkManager()->InvalidateFrameSinkId(frame_sink_id_);
74 } 75 }
75 76
76 void RenderWidgetHostViewChildFrame::Init() { 77 void RenderWidgetHostViewChildFrame::Init() {
77 RegisterFrameSinkId(); 78 RegisterFrameSinkId();
78 host_->SetView(this); 79 host_->SetView(this);
79 GetTextInputManager(); 80 GetTextInputManager();
80 } 81 }
81 82
82 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( 83 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector(
83 CrossProcessFrameConnector* frame_connector) { 84 CrossProcessFrameConnector* frame_connector) {
84 if (frame_connector_ == frame_connector) 85 if (frame_connector_ == frame_connector)
85 return; 86 return;
86 87
87 if (frame_connector_) { 88 if (frame_connector_) {
88 if (parent_frame_sink_id_.is_valid()) { 89 if (parent_frame_sink_id_.is_valid()) {
89 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, 90 GetFrameSinkManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_,
90 frame_sink_id_); 91 frame_sink_id_);
91 } 92 }
92 // Unregister the client here, as it is not guaranteed in tests that the 93 // Unregister the client here, as it is not guaranteed in tests that the
93 // destructor will be called. 94 // destructor will be called.
94 GetSurfaceManager()->UnregisterSurfaceFactoryClient(frame_sink_id_); 95 GetFrameSinkManager()->UnregisterSurfaceFactoryClient(frame_sink_id_);
95 96
96 parent_frame_sink_id_ = cc::FrameSinkId(); 97 parent_frame_sink_id_ = cc::FrameSinkId();
97 98
98 // After the RenderWidgetHostViewChildFrame loses the frame_connector, it 99 // After the RenderWidgetHostViewChildFrame loses the frame_connector, it
99 // won't be able to walk up the frame tree anymore. Clean up anything that 100 // won't be able to walk up the frame tree anymore. Clean up anything that
100 // needs to be done through the CrossProcessFrameConnector before it's gone. 101 // needs to be done through the CrossProcessFrameConnector before it's gone.
101 102
102 // Unlocks the mouse if this RenderWidgetHostView holds the lock. 103 // Unlocks the mouse if this RenderWidgetHostView holds the lock.
103 UnlockMouse(); 104 UnlockMouse();
104 } 105 }
105 frame_connector_ = frame_connector; 106 frame_connector_ = frame_connector;
106 if (frame_connector_) { 107 if (frame_connector_) {
107 GetSurfaceManager()->RegisterSurfaceFactoryClient(frame_sink_id_, this); 108 GetFrameSinkManager()->RegisterSurfaceFactoryClient(frame_sink_id_, this);
108 RenderWidgetHostViewBase* parent_view = 109 RenderWidgetHostViewBase* parent_view =
109 frame_connector_->GetParentRenderWidgetHostView(); 110 frame_connector_->GetParentRenderWidgetHostView();
110 if (parent_view) { 111 if (parent_view) {
111 parent_frame_sink_id_ = parent_view->GetFrameSinkId(); 112 parent_frame_sink_id_ = parent_view->GetFrameSinkId();
112 DCHECK(parent_frame_sink_id_.is_valid()); 113 DCHECK(parent_frame_sink_id_.is_valid());
113 GetSurfaceManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_, 114 GetFrameSinkManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_,
114 frame_sink_id_); 115 frame_sink_id_);
115 } 116 }
116 } 117 }
117 } 118 }
118 119
119 void RenderWidgetHostViewChildFrame::InitAsChild( 120 void RenderWidgetHostViewChildFrame::InitAsChild(
120 gfx::NativeView parent_view) { 121 gfx::NativeView parent_view) {
121 NOTREACHED(); 122 NOTREACHED();
122 } 123 }
123 124
124 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const { 125 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const {
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 757
757 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { 758 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const {
758 return true; 759 return true;
759 } 760 }
760 761
761 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { 762 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const {
762 return cc::SurfaceId(frame_sink_id_, local_surface_id_); 763 return cc::SurfaceId(frame_sink_id_, local_surface_id_);
763 }; 764 };
764 765
765 } // namespace content 766 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698