Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 | 196 |
| 197 } // namespace | 197 } // namespace |
| 198 | 198 |
| 199 namespace content { | 199 namespace content { |
| 200 | 200 |
| 201 // RenderWidget --------------------------------------------------------------- | 201 // RenderWidget --------------------------------------------------------------- |
| 202 | 202 |
| 203 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, | 203 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, |
| 204 blink::WebPopupType popup_type, | 204 blink::WebPopupType popup_type, |
| 205 const ScreenInfo& screen_info, | 205 const ScreenInfo& screen_info, |
| 206 const cc::FrameSinkId& frame_sink_id, | |
| 206 bool swapped_out, | 207 bool swapped_out, |
| 207 bool hidden, | 208 bool hidden, |
| 208 bool never_visible) | 209 bool never_visible) |
| 209 : routing_id_(MSG_ROUTING_NONE), | 210 : routing_id_(MSG_ROUTING_NONE), |
| 210 compositor_deps_(compositor_deps), | 211 compositor_deps_(compositor_deps), |
| 211 webwidget_internal_(nullptr), | 212 webwidget_internal_(nullptr), |
| 212 owner_delegate_(nullptr), | 213 owner_delegate_(nullptr), |
| 213 opener_id_(MSG_ROUTING_NONE), | 214 opener_id_(MSG_ROUTING_NONE), |
| 214 next_paint_flags_(0), | 215 next_paint_flags_(0), |
| 215 auto_resize_mode_(false), | 216 auto_resize_mode_(false), |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 227 for_oopif_(false), | 228 for_oopif_(false), |
| 228 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 229 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 229 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 230 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| 230 text_input_flags_(0), | 231 text_input_flags_(0), |
| 231 can_compose_inline_(true), | 232 can_compose_inline_(true), |
| 232 composition_range_(gfx::Range::InvalidRange()), | 233 composition_range_(gfx::Range::InvalidRange()), |
| 233 popup_type_(popup_type), | 234 popup_type_(popup_type), |
| 234 pending_window_rect_count_(0), | 235 pending_window_rect_count_(0), |
| 235 screen_info_(screen_info), | 236 screen_info_(screen_info), |
| 236 device_scale_factor_(screen_info_.device_scale_factor), | 237 device_scale_factor_(screen_info_.device_scale_factor), |
| 238 frame_sink_id_(frame_sink_id), | |
| 237 #if defined(OS_ANDROID) | 239 #if defined(OS_ANDROID) |
| 238 text_field_is_dirty_(false), | 240 text_field_is_dirty_(false), |
| 239 #endif | 241 #endif |
| 240 monitor_composition_info_(false), | 242 monitor_composition_info_(false), |
| 241 popup_origin_scale_for_emulation_(0.f), | 243 popup_origin_scale_for_emulation_(0.f), |
| 242 frame_swap_message_queue_(new FrameSwapMessageQueue()), | 244 frame_swap_message_queue_(new FrameSwapMessageQueue()), |
| 243 resizing_mode_selector_(new ResizingModeSelector()), | 245 resizing_mode_selector_(new ResizingModeSelector()), |
| 244 has_host_context_menu_location_(false), | 246 has_host_context_menu_location_(false), |
| 245 has_focus_(false), | 247 has_focus_(false), |
| 246 #if defined(OS_MACOSX) | 248 #if defined(OS_MACOSX) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 RenderWidgetInitializedCallback render_widget_initialized) { | 280 RenderWidgetInitializedCallback render_widget_initialized) { |
| 279 CHECK(!g_create_render_widget && !g_render_widget_initialized); | 281 CHECK(!g_create_render_widget && !g_render_widget_initialized); |
| 280 g_create_render_widget = create_render_widget; | 282 g_create_render_widget = create_render_widget; |
| 281 g_render_widget_initialized = render_widget_initialized; | 283 g_render_widget_initialized = render_widget_initialized; |
| 282 } | 284 } |
| 283 | 285 |
| 284 // static | 286 // static |
| 285 RenderWidget* RenderWidget::Create(int32_t opener_id, | 287 RenderWidget* RenderWidget::Create(int32_t opener_id, |
| 286 CompositorDependencies* compositor_deps, | 288 CompositorDependencies* compositor_deps, |
| 287 blink::WebPopupType popup_type, | 289 blink::WebPopupType popup_type, |
| 288 const ScreenInfo& screen_info) { | 290 const ScreenInfo& screen_info, |
| 291 const cc::FrameSinkId& frame_sink_id) { | |
| 289 DCHECK(opener_id != MSG_ROUTING_NONE); | 292 DCHECK(opener_id != MSG_ROUTING_NONE); |
| 290 scoped_refptr<RenderWidget> widget(new RenderWidget( | 293 scoped_refptr<RenderWidget> widget( |
| 291 compositor_deps, popup_type, screen_info, false, false, false)); | 294 new RenderWidget(compositor_deps, popup_type, screen_info, frame_sink_id, |
| 295 false, false, false)); | |
| 292 if (widget->Init(opener_id)) { // adds reference on success. | 296 if (widget->Init(opener_id)) { // adds reference on success. |
| 293 return widget.get(); | 297 return widget.get(); |
| 294 } | 298 } |
| 295 return NULL; | 299 return NULL; |
| 296 } | 300 } |
| 297 | 301 |
| 298 // static | 302 // static |
| 299 RenderWidget* RenderWidget::CreateForFrame( | 303 RenderWidget* RenderWidget::CreateForFrame( |
| 300 int routing_id, | 304 int routing_id, |
| 301 bool hidden, | 305 bool hidden, |
| 302 const ScreenInfo& screen_info, | 306 const ScreenInfo& screen_info, |
| 303 CompositorDependencies* compositor_deps, | 307 CompositorDependencies* compositor_deps, |
| 304 blink::WebLocalFrame* frame) { | 308 blink::WebLocalFrame* frame, |
| 309 const cc::FrameSinkId& frame_sink_id) { | |
| 305 CHECK_NE(routing_id, MSG_ROUTING_NONE); | 310 CHECK_NE(routing_id, MSG_ROUTING_NONE); |
| 306 // TODO(avi): Before RenderViewImpl has-a RenderWidget, the browser passes the | 311 // TODO(avi): Before RenderViewImpl has-a RenderWidget, the browser passes the |
| 307 // same routing ID for both the view routing ID and the main frame widget | 312 // same routing ID for both the view routing ID and the main frame widget |
| 308 // routing ID. https://crbug.com/545684 | 313 // routing ID. https://crbug.com/545684 |
| 309 RenderViewImpl* view = RenderViewImpl::FromRoutingID(routing_id); | 314 RenderViewImpl* view = RenderViewImpl::FromRoutingID(routing_id); |
| 310 if (view) { | 315 if (view) { |
| 311 view->AttachWebFrameWidget( | 316 view->AttachWebFrameWidget( |
| 312 RenderWidget::CreateWebFrameWidget(view->GetWidget(), frame)); | 317 RenderWidget::CreateWebFrameWidget(view->GetWidget(), frame)); |
| 313 return view->GetWidget(); | 318 return view->GetWidget(); |
| 314 } | 319 } |
| 315 scoped_refptr<RenderWidget> widget( | 320 scoped_refptr<RenderWidget> widget( |
| 316 g_create_render_widget | 321 g_create_render_widget |
| 317 ? g_create_render_widget(compositor_deps, blink::WebPopupTypeNone, | 322 ? g_create_render_widget(compositor_deps, blink::WebPopupTypeNone, |
| 318 screen_info, false, hidden, false) | 323 screen_info, frame_sink_id, false, hidden, |
|
Fady Samuel
2016/10/26 15:00:18
This isn't right. Each RenderWidget should share t
| |
| 324 false) | |
| 319 : new RenderWidget(compositor_deps, blink::WebPopupTypeNone, | 325 : new RenderWidget(compositor_deps, blink::WebPopupTypeNone, |
| 320 screen_info, false, hidden, false)); | 326 screen_info, frame_sink_id, false, hidden, false)); |
| 321 widget->SetRoutingID(routing_id); | 327 widget->SetRoutingID(routing_id); |
| 322 widget->for_oopif_ = true; | 328 widget->for_oopif_ = true; |
| 323 // DoInit increments the reference count on |widget|, keeping it alive after | 329 // DoInit increments the reference count on |widget|, keeping it alive after |
| 324 // this function returns. | 330 // this function returns. |
| 325 if (widget->DoInit(MSG_ROUTING_NONE, | 331 if (widget->DoInit(MSG_ROUTING_NONE, |
| 326 RenderWidget::CreateWebFrameWidget(widget.get(), frame), | 332 RenderWidget::CreateWebFrameWidget(widget.get(), frame), |
| 327 nullptr)) { | 333 nullptr)) { |
| 328 if (g_render_widget_initialized) | 334 if (g_render_widget_initialized) |
| 329 g_render_widget_initialized(widget.get()); | 335 g_render_widget_initialized(widget.get()); |
| 330 return widget.get(); | 336 return widget.get(); |
| (...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2096 bool RenderWidget::isPointerLocked() { | 2102 bool RenderWidget::isPointerLocked() { |
| 2097 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2103 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2098 webwidget_mouse_lock_target_.get()); | 2104 webwidget_mouse_lock_target_.get()); |
| 2099 } | 2105 } |
| 2100 | 2106 |
| 2101 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2107 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2102 return webwidget_internal_; | 2108 return webwidget_internal_; |
| 2103 } | 2109 } |
| 2104 | 2110 |
| 2105 } // namespace content | 2111 } // namespace content |
| OLD | NEW |