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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 view_->SelectionBoundsChanged(params); | 1300 view_->SelectionBoundsChanged(params); |
1295 } | 1301 } |
1296 } | 1302 } |
1297 | 1303 |
1298 void RenderWidgetHostImpl::OnForwardCompositorProto( | 1304 void RenderWidgetHostImpl::OnForwardCompositorProto( |
1299 const std::vector<uint8_t>& proto) { | 1305 const std::vector<uint8_t>& proto) { |
1300 if (delegate_) | 1306 if (delegate_) |
1301 delegate_->ForwardCompositorProto(this, proto); | 1307 delegate_->ForwardCompositorProto(this, proto); |
1302 } | 1308 } |
1303 | 1309 |
| 1310 void RenderWidgetHostImpl::OnSetNeedsBeginFrames(bool needs_begin_frames) { |
| 1311 if (needs_begin_frames_ == needs_begin_frames) |
| 1312 return; |
| 1313 |
| 1314 needs_begin_frames_ = needs_begin_frames; |
| 1315 if (view_) |
| 1316 view_->SetNeedsBeginFrames(needs_begin_frames); |
| 1317 } |
| 1318 |
1304 void RenderWidgetHostImpl::UpdateVSyncParameters(base::TimeTicks timebase, | 1319 void RenderWidgetHostImpl::UpdateVSyncParameters(base::TimeTicks timebase, |
1305 base::TimeDelta interval) { | 1320 base::TimeDelta interval) { |
1306 Send(new ViewMsg_UpdateVSyncParameters(GetRoutingID(), timebase, interval)); | 1321 Send(new ViewMsg_UpdateVSyncParameters(GetRoutingID(), timebase, interval)); |
1307 } | 1322 } |
1308 | 1323 |
1309 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, | 1324 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
1310 int exit_code) { | 1325 int exit_code) { |
1311 if (!renderer_initialized_) | 1326 if (!renderer_initialized_) |
1312 return; | 1327 return; |
1313 | 1328 |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2185 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2171 } | 2186 } |
2172 | 2187 |
2173 BrowserAccessibilityManager* | 2188 BrowserAccessibilityManager* |
2174 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2189 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2175 return delegate_ ? | 2190 return delegate_ ? |
2176 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2191 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2177 } | 2192 } |
2178 | 2193 |
2179 } // namespace content | 2194 } // namespace content |
OLD | NEW |