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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 448 |
449 // Requests the renderer to move the caret selection towards the point. | 449 // Requests the renderer to move the caret selection towards the point. |
450 void MoveCaret(const gfx::Point& point); | 450 void MoveCaret(const gfx::Point& point); |
451 | 451 |
452 // Called when the reponse to a pending mouse lock request has arrived. | 452 // Called when the reponse to a pending mouse lock request has arrived. |
453 // Returns true if |allowed| is true and the mouse has been successfully | 453 // Returns true if |allowed| is true and the mouse has been successfully |
454 // locked. | 454 // locked. |
455 bool GotResponseToLockMouseRequest(bool allowed); | 455 bool GotResponseToLockMouseRequest(bool allowed); |
456 | 456 |
457 // Called by the view in response to OnSwapCompositorFrame. | 457 // Called by the view in response to OnSwapCompositorFrame. |
458 static void SendReclaimCompositorResources( | 458 void SendReclaimCompositorResources( |
459 int32_t route_id, | |
460 uint32_t compositor_frame_sink_id, | |
461 int renderer_host_id, | |
462 bool is_swap_ack, | 459 bool is_swap_ack, |
463 const cc::ReturnedResourceArray& resources); | 460 const cc::ReturnedResourceArray& resources); |
464 | 461 |
465 void set_allow_privileged_mouse_lock(bool allow) { | 462 void set_allow_privileged_mouse_lock(bool allow) { |
466 allow_privileged_mouse_lock_ = allow; | 463 allow_privileged_mouse_lock_ = allow; |
467 } | 464 } |
468 | 465 |
469 // Resets state variables related to tracking pending size and painting. | 466 // Resets state variables related to tracking pending size and painting. |
470 // | 467 // |
471 // We need to reset these flags when we want to repaint the contents of | 468 // We need to reset these flags when we want to repaint the contents of |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // true, RenderWidget will respond immediately. If |monitor_updates| is true, | 567 // true, RenderWidget will respond immediately. If |monitor_updates| is true, |
571 // then RenderWidget sends updates for each compositor frame when there are | 568 // then RenderWidget sends updates for each compositor frame when there are |
572 // changes, or when the text selection changes inside a frame. If both fields | 569 // changes, or when the text selection changes inside a frame. If both fields |
573 // are false, RenderWidget will not send any updates. To avoid sending | 570 // are false, RenderWidget will not send any updates. To avoid sending |
574 // unnecessary IPCs to RenderWidget (e.g., asking for monitor updates while | 571 // unnecessary IPCs to RenderWidget (e.g., asking for monitor updates while |
575 // we are already receiving updates), when | 572 // we are already receiving updates), when |
576 // |monitoring_composition_info_| == |monitor_updates| no IPC is sent to the | 573 // |monitoring_composition_info_| == |monitor_updates| no IPC is sent to the |
577 // renderer unless it is for an immediate request. | 574 // renderer unless it is for an immediate request. |
578 void RequestCompositionUpdates(bool immediate_request, bool monitor_updates); | 575 void RequestCompositionUpdates(bool immediate_request, bool monitor_updates); |
579 | 576 |
| 577 // Submits the frame received from RenderWidget. |
| 578 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, |
| 579 cc::CompositorFrame frame); |
| 580 |
580 protected: | 581 protected: |
581 // --------------------------------------------------------------------------- | 582 // --------------------------------------------------------------------------- |
582 // The following method is overridden by RenderViewHost to send upwards to | 583 // The following method is overridden by RenderViewHost to send upwards to |
583 // its delegate. | 584 // its delegate. |
584 | 585 |
585 // Callback for notification that we failed to receive any rendered graphics | 586 // Callback for notification that we failed to receive any rendered graphics |
586 // from a newly loaded page. Used for testing. | 587 // from a newly loaded page. Used for testing. |
587 virtual void NotifyNewContentRenderingTimeoutForTesting() {} | 588 virtual void NotifyNewContentRenderingTimeoutForTesting() {} |
588 | 589 |
589 // --------------------------------------------------------------------------- | 590 // --------------------------------------------------------------------------- |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 // compared against current_content_source_id_ to determine whether the | 923 // compared against current_content_source_id_ to determine whether the |
923 // received frame belongs to the current page. If a frame for the current page | 924 // received frame belongs to the current page. If a frame for the current page |
924 // does not arrive in time after nagivation, we clear the graphics of the old | 925 // does not arrive in time after nagivation, we clear the graphics of the old |
925 // page. See RenderWidget::current_content_source_id_ for more information. | 926 // page. See RenderWidget::current_content_source_id_ for more information. |
926 uint32_t last_received_content_source_id_ = 0; | 927 uint32_t last_received_content_source_id_ = 0; |
927 | 928 |
928 #if defined(OS_MACOSX) | 929 #if defined(OS_MACOSX) |
929 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; | 930 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; |
930 #endif | 931 #endif |
931 | 932 |
| 933 // These information are used to verify that the renderer does not misbehave |
| 934 // when it comes to allocating LocalSurfaceIds. If frame size or device scale |
| 935 // factor change, a new LocalSurfaceId must be created. |
932 cc::LocalSurfaceId last_local_surface_id_; | 936 cc::LocalSurfaceId last_local_surface_id_; |
933 gfx::Size last_frame_size_; | 937 gfx::Size last_frame_size_; |
934 float last_device_scale_factor_; | 938 float last_device_scale_factor_; |
935 | 939 |
| 940 // Each instance of RendererCompositorFrameSink has an ID that we keep track |
| 941 // of so we can tell when a new instance has been created for the purpose of |
| 942 // not returning stale resources. |
| 943 uint32_t last_compositor_frame_sink_id_ = 0; |
| 944 |
936 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 945 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
937 | 946 |
938 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 947 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
939 }; | 948 }; |
940 | 949 |
941 } // namespace content | 950 } // namespace content |
942 | 951 |
943 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 952 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
OLD | NEW |