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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 monitor_composition_info_(false), | 240 monitor_composition_info_(false), |
| 241 popup_origin_scale_for_emulation_(0.f), | 241 popup_origin_scale_for_emulation_(0.f), |
| 242 frame_swap_message_queue_(new FrameSwapMessageQueue()), | 242 frame_swap_message_queue_(new FrameSwapMessageQueue()), |
| 243 resizing_mode_selector_(new ResizingModeSelector()), | 243 resizing_mode_selector_(new ResizingModeSelector()), |
| 244 has_host_context_menu_location_(false), | 244 has_host_context_menu_location_(false), |
| 245 has_focus_(false), | 245 has_focus_(false), |
| 246 #if defined(OS_MACOSX) | 246 #if defined(OS_MACOSX) |
| 247 text_input_client_observer_(new TextInputClientObserver(this)), | 247 text_input_client_observer_(new TextInputClientObserver(this)), |
| 248 #endif | 248 #endif |
| 249 focused_pepper_plugin_(nullptr) { | 249 focused_pepper_plugin_(nullptr) { |
| 250 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
|
Fady Samuel
2016/10/27 20:15:55
I see no point in saving this here.
Alex Z.
2016/10/28 18:09:47
Done.
| |
| 251 switches::kRendererClientId)) { | |
| 252 std::string client_id_str = | |
| 253 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 254 switches::kRendererClientId); | |
| 255 client_id_ = std::stoi(client_id_str); | |
| 256 } | |
| 250 if (!swapped_out) | 257 if (!swapped_out) |
| 251 RenderProcess::current()->AddRefProcess(); | 258 RenderProcess::current()->AddRefProcess(); |
| 252 DCHECK(RenderThread::Get()); | 259 DCHECK(RenderThread::Get()); |
| 253 device_color_profile_.push_back('0'); | 260 device_color_profile_.push_back('0'); |
| 254 #if defined(OS_ANDROID) | 261 #if defined(OS_ANDROID) |
| 255 text_input_info_history_.push_back(blink::WebTextInputInfo()); | 262 text_input_info_history_.push_back(blink::WebTextInputInfo()); |
| 256 #endif | 263 #endif |
| 257 | 264 |
| 258 // In tests there may not be a RenderThreadImpl. | 265 // In tests there may not be a RenderThreadImpl. |
| 259 if (RenderThreadImpl::current()) { | 266 if (RenderThreadImpl::current()) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 } | 365 } |
| 359 | 366 |
| 360 void RenderWidget::CloseForFrame() { | 367 void RenderWidget::CloseForFrame() { |
| 361 OnClose(); | 368 OnClose(); |
| 362 } | 369 } |
| 363 | 370 |
| 364 void RenderWidget::SetRoutingID(int32_t routing_id) { | 371 void RenderWidget::SetRoutingID(int32_t routing_id) { |
| 365 routing_id_ = routing_id; | 372 routing_id_ = routing_id; |
| 366 input_handler_.reset(new RenderWidgetInputHandler( | 373 input_handler_.reset(new RenderWidgetInputHandler( |
| 367 GetRenderWidgetInputHandlerDelegate(this), this)); | 374 GetRenderWidgetInputHandlerDelegate(this), this)); |
| 375 | |
| 376 OnSetFrameSinkId(cc::FrameSinkId(client_id_, routing_id_)); | |
|
Fady Samuel
2016/10/27 20:15:55
I don't believe we have a RenderWidgetCompositor y
Alex Z.
2016/10/28 18:09:47
Done.
| |
| 368 } | 377 } |
| 369 | 378 |
| 370 void RenderWidget::SetSwappedOut(bool is_swapped_out) { | 379 void RenderWidget::SetSwappedOut(bool is_swapped_out) { |
| 371 // We should only toggle between states. | 380 // We should only toggle between states. |
| 372 DCHECK(is_swapped_out_ != is_swapped_out); | 381 DCHECK(is_swapped_out_ != is_swapped_out); |
| 373 is_swapped_out_ = is_swapped_out; | 382 is_swapped_out_ = is_swapped_out; |
| 374 | 383 |
| 375 // If we are swapping out, we will call ReleaseProcess, allowing the process | 384 // If we are swapping out, we will call ReleaseProcess, allowing the process |
| 376 // to exit if all of its RenderViews are swapped out. We wait until the | 385 // to exit if all of its RenderViews are swapped out. We wait until the |
| 377 // WasSwappedOut call to do this, to allow the unload handler to finish. | 386 // WasSwappedOut call to do this, to allow the unload handler to finish. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 503 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 495 OnEnableDeviceEmulation) | 504 OnEnableDeviceEmulation) |
| 496 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 505 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
| 497 OnDisableDeviceEmulation) | 506 OnDisableDeviceEmulation) |
| 498 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 507 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
| 499 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 508 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
| 500 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 509 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
| 501 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 510 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
| 502 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 511 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
| 503 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 512 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
| 504 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) | 513 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) |
|
Fady Samuel
2016/10/27 20:15:55
Get rid of this.
Alex Z.
2016/10/28 18:09:47
Done.
| |
| 505 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, | 514 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, |
| 506 OnWaitNextFrameForTests) | 515 OnWaitNextFrameForTests) |
| 507 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, | 516 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
| 508 OnRequestCompositionUpdate) | 517 OnRequestCompositionUpdate) |
| 509 #if defined(OS_ANDROID) | 518 #if defined(OS_ANDROID) |
| 510 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 519 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
| 511 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 520 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
| 512 OnRequestTextInputStateUpdate) | 521 OnRequestTextInputStateUpdate) |
| 513 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, | 522 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, |
| 514 OnImeBatchEdit) | 523 OnImeBatchEdit) |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1107 compositor_deps_); | 1116 compositor_deps_); |
| 1108 compositor_->setViewportSize(physical_backing_size_); | 1117 compositor_->setViewportSize(physical_backing_size_); |
| 1109 OnDeviceScaleFactorChanged(); | 1118 OnDeviceScaleFactorChanged(); |
| 1110 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); | 1119 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); |
| 1111 // For background pages and certain tests, we don't want to trigger | 1120 // For background pages and certain tests, we don't want to trigger |
| 1112 // CompositorFrameSink creation. | 1121 // CompositorFrameSink creation. |
| 1113 if (compositor_never_visible_ || !RenderThreadImpl::current()) | 1122 if (compositor_never_visible_ || !RenderThreadImpl::current()) |
| 1114 compositor_->SetNeverVisible(); | 1123 compositor_->SetNeverVisible(); |
| 1115 | 1124 |
| 1116 StartCompositor(); | 1125 StartCompositor(); |
| 1126 compositor_->SetFrameSinkId(cc::FrameSinkId(client_id_, routing_id_)); | |
|
Fady Samuel
2016/10/27 20:15:55
We can simply read the client id from commandline
Alex Z.
2016/10/28 18:09:47
Done.
| |
| 1117 } | 1127 } |
| 1118 | 1128 |
| 1119 void RenderWidget::WillCloseLayerTreeView() { | 1129 void RenderWidget::WillCloseLayerTreeView() { |
| 1120 if (host_closing_) | 1130 if (host_closing_) |
| 1121 return; | 1131 return; |
| 1122 | 1132 |
| 1123 // Prevent new compositors or output surfaces from being created. | 1133 // Prevent new compositors or output surfaces from being created. |
| 1124 host_closing_ = true; | 1134 host_closing_ = true; |
| 1125 | 1135 |
| 1126 // Always send this notification to prevent new layer tree views from | 1136 // Always send this notification to prevent new layer tree views from |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2088 bool RenderWidget::isPointerLocked() { | 2098 bool RenderWidget::isPointerLocked() { |
| 2089 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2099 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2090 webwidget_mouse_lock_target_.get()); | 2100 webwidget_mouse_lock_target_.get()); |
| 2091 } | 2101 } |
| 2092 | 2102 |
| 2093 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2103 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2094 return webwidget_internal_; | 2104 return webwidget_internal_; |
| 2095 } | 2105 } |
| 2096 | 2106 |
| 2097 } // namespace content | 2107 } // namespace content |
| OLD | NEW |