| 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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 315 |
| 316 return std::move(hosts); | 316 return std::move(hosts); |
| 317 } | 317 } |
| 318 | 318 |
| 319 // static | 319 // static |
| 320 RenderWidgetHostImpl* RenderWidgetHostImpl::From(RenderWidgetHost* rwh) { | 320 RenderWidgetHostImpl* RenderWidgetHostImpl::From(RenderWidgetHost* rwh) { |
| 321 return static_cast<RenderWidgetHostImpl*>(rwh); | 321 return static_cast<RenderWidgetHostImpl*>(rwh); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { | 324 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { |
| 325 if (view) | 325 if (view) { |
| 326 view_ = view->GetWeakPtr(); | 326 view_ = view->GetWeakPtr(); |
| 327 else | 327 // Views start out not needing begin frames, so only update its state |
| 328 // if the value has changed. |
| 329 if (needs_begin_frames_) |
| 330 view_->SetNeedsBeginFrames(needs_begin_frames_); |
| 331 } else { |
| 328 view_.reset(); | 332 view_.reset(); |
| 333 } |
| 329 | 334 |
| 330 // If the renderer has not yet been initialized, then the surface ID | 335 // If the renderer has not yet been initialized, then the surface ID |
| 331 // namespace will be sent during initialization. | 336 // namespace will be sent during initialization. |
| 332 if (view_ && renderer_initialized_) { | 337 if (view_ && renderer_initialized_) { |
| 333 Send(new ViewMsg_SetSurfaceClientId(routing_id_, | 338 Send(new ViewMsg_SetSurfaceClientId(routing_id_, |
| 334 view_->GetSurfaceClientId())); | 339 view_->GetSurfaceClientId())); |
| 335 } | 340 } |
| 336 | 341 |
| 337 synthetic_gesture_controller_.reset(); | 342 synthetic_gesture_controller_.reset(); |
| 338 } | 343 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 OnShowDisambiguationPopup) | 473 OnShowDisambiguationPopup) |
| 469 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) | 474 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) |
| 470 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, | 475 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, |
| 471 OnSelectionBoundsChanged) | 476 OnSelectionBoundsChanged) |
| 472 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, | 477 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged, |
| 473 OnImeCompositionRangeChanged) | 478 OnImeCompositionRangeChanged) |
| 474 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad, | 479 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad, |
| 475 OnFirstPaintAfterLoad) | 480 OnFirstPaintAfterLoad) |
| 476 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardCompositorProto, | 481 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardCompositorProto, |
| 477 OnForwardCompositorProto) | 482 OnForwardCompositorProto) |
| 483 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames, OnSetNeedsBeginFrames) |
| 478 IPC_MESSAGE_UNHANDLED(handled = false) | 484 IPC_MESSAGE_UNHANDLED(handled = false) |
| 479 IPC_END_MESSAGE_MAP() | 485 IPC_END_MESSAGE_MAP() |
| 480 | 486 |
| 481 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) | 487 if (!handled && input_router_ && input_router_->OnMessageReceived(msg)) |
| 482 return true; | 488 return true; |
| 483 | 489 |
| 484 if (!handled && view_ && view_->OnMessageReceived(msg)) | 490 if (!handled && view_ && view_->OnMessageReceived(msg)) |
| 485 return true; | 491 return true; |
| 486 | 492 |
| 487 return handled; | 493 return handled; |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 view_->SelectionBoundsChanged(params); | 1303 view_->SelectionBoundsChanged(params); |
| 1298 } | 1304 } |
| 1299 } | 1305 } |
| 1300 | 1306 |
| 1301 void RenderWidgetHostImpl::OnForwardCompositorProto( | 1307 void RenderWidgetHostImpl::OnForwardCompositorProto( |
| 1302 const std::vector<uint8_t>& proto) { | 1308 const std::vector<uint8_t>& proto) { |
| 1303 if (delegate_) | 1309 if (delegate_) |
| 1304 delegate_->ForwardCompositorProto(this, proto); | 1310 delegate_->ForwardCompositorProto(this, proto); |
| 1305 } | 1311 } |
| 1306 | 1312 |
| 1313 void RenderWidgetHostImpl::OnSetNeedsBeginFrames(bool needs_begin_frames) { |
| 1314 if (needs_begin_frames_ == needs_begin_frames) |
| 1315 return; |
| 1316 |
| 1317 needs_begin_frames_ = needs_begin_frames; |
| 1318 if (view_) |
| 1319 view_->SetNeedsBeginFrames(needs_begin_frames); |
| 1320 } |
| 1321 |
| 1307 void RenderWidgetHostImpl::UpdateVSyncParameters(base::TimeTicks timebase, | 1322 void RenderWidgetHostImpl::UpdateVSyncParameters(base::TimeTicks timebase, |
| 1308 base::TimeDelta interval) { | 1323 base::TimeDelta interval) { |
| 1309 Send(new ViewMsg_UpdateVSyncParameters(GetRoutingID(), timebase, interval)); | 1324 Send(new ViewMsg_UpdateVSyncParameters(GetRoutingID(), timebase, interval)); |
| 1310 } | 1325 } |
| 1311 | 1326 |
| 1312 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, | 1327 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
| 1313 int exit_code) { | 1328 int exit_code) { |
| 1314 if (!renderer_initialized_) | 1329 if (!renderer_initialized_) |
| 1315 return; | 1330 return; |
| 1316 | 1331 |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2188 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
| 2174 } | 2189 } |
| 2175 | 2190 |
| 2176 BrowserAccessibilityManager* | 2191 BrowserAccessibilityManager* |
| 2177 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2192 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
| 2178 return delegate_ ? | 2193 return delegate_ ? |
| 2179 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2194 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
| 2180 } | 2195 } |
| 2181 | 2196 |
| 2182 } // namespace content | 2197 } // namespace content |
| OLD | NEW |