Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: content/renderer/render_widget.h

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_RENDERER_RENDER_WIDGET_H_ 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <map> 12 #include <map>
13 #include <memory>
13 14
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
23 #include "content/common/cursors/webcursor.h" 23 #include "content/common/cursors/webcursor.h"
24 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 24 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
25 #include "content/common/input/synthetic_gesture_params.h" 25 #include "content/common/input/synthetic_gesture_params.h"
26 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega te.h" 26 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega te.h"
27 #include "content/renderer/gpu/render_widget_compositor_delegate.h" 27 #include "content/renderer/gpu/render_widget_compositor_delegate.h"
28 #include "content/renderer/input/render_widget_input_handler.h" 28 #include "content/renderer/input/render_widget_input_handler.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // IPC::Sender 178 // IPC::Sender
179 bool Send(IPC::Message* msg) override; 179 bool Send(IPC::Message* msg) override;
180 180
181 // RenderWidgetCompositorDelegate 181 // RenderWidgetCompositorDelegate
182 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 182 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
183 const gfx::Vector2dF& outer_delta, 183 const gfx::Vector2dF& outer_delta,
184 const gfx::Vector2dF& elastic_overscroll_delta, 184 const gfx::Vector2dF& elastic_overscroll_delta,
185 float page_scale, 185 float page_scale,
186 float top_controls_delta) override; 186 float top_controls_delta) override;
187 void BeginMainFrame(double frame_time_sec) override; 187 void BeginMainFrame(double frame_time_sec) override;
188 scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) override; 188 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(
189 scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource() override; 189 bool fallback) override;
190 std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource()
191 override;
190 void DidCommitAndDrawCompositorFrame() override; 192 void DidCommitAndDrawCompositorFrame() override;
191 void DidCommitCompositorFrame() override; 193 void DidCommitCompositorFrame() override;
192 void DidCompletePageScaleAnimation() override; 194 void DidCompletePageScaleAnimation() override;
193 void DidCompleteSwapBuffers() override; 195 void DidCompleteSwapBuffers() override;
194 bool ForOOPIF() const override; 196 bool ForOOPIF() const override;
195 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override; 197 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override;
196 bool IsClosing() const override; 198 bool IsClosing() const override;
197 void OnSwapBuffersAborted() override; 199 void OnSwapBuffersAborted() override;
198 void OnSwapBuffersComplete() override; 200 void OnSwapBuffersComplete() override;
199 void OnSwapBuffersPosted() override; 201 void OnSwapBuffersPosted() override;
200 void RecordFrameTimingEvents( 202 void RecordFrameTimingEvents(
201 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, 203 std::unique_ptr<cc::FrameTimingTracker::CompositeTimingSet>
202 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) 204 composite_events,
203 override; 205 std::unique_ptr<cc::FrameTimingTracker::MainFrameTimingSet>
206 main_frame_events) override;
204 void RequestScheduleAnimation() override; 207 void RequestScheduleAnimation() override;
205 void UpdateVisualState() override; 208 void UpdateVisualState() override;
206 void WillBeginCompositorFrame() override; 209 void WillBeginCompositorFrame() override;
207 210
208 // RenderWidgetInputHandlerDelegate 211 // RenderWidgetInputHandlerDelegate
209 void FocusChangeComplete() override; 212 void FocusChangeComplete() override;
210 bool HasTouchEventHandlersAt(const gfx::Point& point) const override; 213 bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
211 void ObserveWheelEventAndResult(const blink::WebMouseWheelEvent& wheel_event, 214 void ObserveWheelEventAndResult(const blink::WebMouseWheelEvent& wheel_event,
212 const gfx::Vector2dF& wheel_unused_delta, 215 const gfx::Vector2dF& wheel_unused_delta,
213 bool event_processed) override; 216 bool event_processed) override;
214 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event, 217 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
215 const gfx::Vector2dF& unused_delta, 218 const gfx::Vector2dF& unused_delta,
216 bool event_processed) override; 219 bool event_processed) override;
217 220
218 void OnDidHandleKeyEvent() override; 221 void OnDidHandleKeyEvent() override;
219 void OnDidOverscroll(const DidOverscrollParams& params) override; 222 void OnDidOverscroll(const DidOverscrollParams& params) override;
220 void OnInputEventAck(scoped_ptr<InputEventAck> input_event_ack) override; 223 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override;
221 void NotifyInputEventHandled( 224 void NotifyInputEventHandled(
222 blink::WebInputEvent::Type handled_type) override; 225 blink::WebInputEvent::Type handled_type) override;
223 void SetInputHandler(RenderWidgetInputHandler* input_handler) override; 226 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
224 void UpdateTextInputState(ShowIme show_ime, 227 void UpdateTextInputState(ShowIme show_ime,
225 ChangeSource change_source) override; 228 ChangeSource change_source) override;
226 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; 229 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
227 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; 230 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
228 231
229 // RenderWidgetScreenMetricsDelegate 232 // RenderWidgetScreenMetricsDelegate
230 void Redraw() override; 233 void Redraw() override;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // When resumed from pause in debugger while handling mouse move, 303 // When resumed from pause in debugger while handling mouse move,
301 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger). 304 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
302 void IgnoreAckForMouseMoveFromDebugger(); 305 void IgnoreAckForMouseMoveFromDebugger();
303 306
304 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll). 307 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
305 typedef base::Callback<void()> SyntheticGestureCompletionCallback; 308 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
306 309
307 // Send a synthetic gesture to the browser to be queued to the synthetic 310 // Send a synthetic gesture to the browser to be queued to the synthetic
308 // gesture controller. 311 // gesture controller.
309 void QueueSyntheticGesture( 312 void QueueSyntheticGesture(
310 scoped_ptr<SyntheticGestureParams> gesture_params, 313 std::unique_ptr<SyntheticGestureParams> gesture_params,
311 const SyntheticGestureCompletionCallback& callback); 314 const SyntheticGestureCompletionCallback& callback);
312 315
313 // Deliveres |message| together with compositor state change updates. The 316 // Deliveres |message| together with compositor state change updates. The
314 // exact behavior depends on |policy|. 317 // exact behavior depends on |policy|.
315 // This mechanism is not a drop-in replacement for IPC: messages sent this way 318 // This mechanism is not a drop-in replacement for IPC: messages sent this way
316 // will not be automatically available to BrowserMessageFilter, for example. 319 // will not be automatically available to BrowserMessageFilter, for example.
317 // FIFO ordering is preserved between messages enqueued with the same 320 // FIFO ordering is preserved between messages enqueued with the same
318 // |policy|, the ordering between messages enqueued for different policies is 321 // |policy|, the ordering between messages enqueued for different policies is
319 // undefined. 322 // undefined.
320 // 323 //
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 void SetHidden(bool hidden); 508 void SetHidden(bool hidden);
506 509
507 void DidToggleFullscreen(); 510 void DidToggleFullscreen();
508 511
509 bool next_paint_is_resize_ack() const; 512 bool next_paint_is_resize_ack() const;
510 void set_next_paint_is_resize_ack(); 513 void set_next_paint_is_resize_ack();
511 void set_next_paint_is_repaint_ack(); 514 void set_next_paint_is_repaint_ack();
512 515
513 // QueueMessage implementation extracted into a static method for easy 516 // QueueMessage implementation extracted into a static method for easy
514 // testing. 517 // testing.
515 static scoped_ptr<cc::SwapPromise> QueueMessageImpl( 518 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
516 IPC::Message* msg, 519 IPC::Message* msg,
517 MessageDeliveryPolicy policy, 520 MessageDeliveryPolicy policy,
518 FrameSwapMessageQueue* frame_swap_message_queue, 521 FrameSwapMessageQueue* frame_swap_message_queue,
519 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter, 522 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
520 int source_frame_number); 523 int source_frame_number);
521 524
522 // Override point to obtain that the current composition character bounds. 525 // Override point to obtain that the current composition character bounds.
523 // In the case of surrogate pairs, the character is treated as two characters: 526 // In the case of surrogate pairs, the character is treated as two characters:
524 // the bounds for first character is actual one, and the bounds for second 527 // the bounds for first character is actual one, and the bounds for second
525 // character is zero width rectangle. 528 // character is zero width rectangle.
(...skipping 26 matching lines...) Expand all
552 void hasTouchEventHandlers(bool has_handlers) override; 555 void hasTouchEventHandlers(bool has_handlers) override;
553 556
554 // Tell the browser about the actions permitted for a new touch point. 557 // Tell the browser about the actions permitted for a new touch point.
555 void setTouchAction(blink::WebTouchAction touch_action) override; 558 void setTouchAction(blink::WebTouchAction touch_action) override;
556 559
557 // Called when value of focused text field gets dirty, e.g. value is modified 560 // Called when value of focused text field gets dirty, e.g. value is modified
558 // by script, not by user input. 561 // by script, not by user input.
559 void didUpdateTextOfFocusedElementByNonUserInput() override; 562 void didUpdateTextOfFocusedElementByNonUserInput() override;
560 563
561 // Creates a 3D context associated with this view. 564 // Creates a 3D context associated with this view.
562 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D( 565 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl>
563 gpu::GpuChannelHost* gpu_channel_host); 566 CreateGraphicsContext3D(gpu::GpuChannelHost* gpu_channel_host);
564 567
565 // Sends an ACK to the browser process during the next compositor frame. 568 // Sends an ACK to the browser process during the next compositor frame.
566 void OnWaitNextFrameForTests(int routing_id); 569 void OnWaitNextFrameForTests(int routing_id);
567 570
568 // Routing ID that allows us to communicate to the parent browser process 571 // Routing ID that allows us to communicate to the parent browser process
569 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. 572 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
570 int32_t routing_id_; 573 int32_t routing_id_;
571 574
572 // Dependencies for initializing a compositor, including flags for optional 575 // Dependencies for initializing a compositor, including flags for optional
573 // features. 576 // features.
574 CompositorDependencies* const compositor_deps_; 577 CompositorDependencies* const compositor_deps_;
575 578
576 // We are responsible for destroying this object via its Close method. 579 // We are responsible for destroying this object via its Close method.
577 // May be NULL when the window is closing. 580 // May be NULL when the window is closing.
578 blink::WebWidget* webwidget_; 581 blink::WebWidget* webwidget_;
579 582
580 // The delegate of the owner of this object. 583 // The delegate of the owner of this object.
581 RenderWidgetOwnerDelegate* owner_delegate_; 584 RenderWidgetOwnerDelegate* owner_delegate_;
582 585
583 // This is lazily constructed and must not outlive webwidget_. 586 // This is lazily constructed and must not outlive webwidget_.
584 scoped_ptr<RenderWidgetCompositor> compositor_; 587 std::unique_ptr<RenderWidgetCompositor> compositor_;
585 588
586 // Set to the ID of the view that initiated creating this view, if any. When 589 // Set to the ID of the view that initiated creating this view, if any. When
587 // the view was initiated by the browser (the common case), this will be 590 // the view was initiated by the browser (the common case), this will be
588 // MSG_ROUTING_NONE. This is used in determining ownership when opening 591 // MSG_ROUTING_NONE. This is used in determining ownership when opening
589 // child tabs. See RenderWidget::createWebViewWithRequest. 592 // child tabs. See RenderWidget::createWebViewWithRequest.
590 // 593 //
591 // This ID may refer to an invalid view if that view is closed before this 594 // This ID may refer to an invalid view if that view is closed before this
592 // view is. 595 // view is.
593 int32_t opener_id_; 596 int32_t opener_id_;
594 597
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 699
697 // While we are waiting for the browser to update window sizes, we track the 700 // While we are waiting for the browser to update window sizes, we track the
698 // pending size temporarily. 701 // pending size temporarily.
699 int pending_window_rect_count_; 702 int pending_window_rect_count_;
700 blink::WebRect pending_window_rect_; 703 blink::WebRect pending_window_rect_;
701 704
702 // The screen rects of the view and the window that contains it. 705 // The screen rects of the view and the window that contains it.
703 gfx::Rect view_screen_rect_; 706 gfx::Rect view_screen_rect_;
704 gfx::Rect window_screen_rect_; 707 gfx::Rect window_screen_rect_;
705 708
706 scoped_ptr<RenderWidgetInputHandler> input_handler_; 709 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
707 710
708 // The time spent in input handlers this frame. Used to throttle input acks. 711 // The time spent in input handlers this frame. Used to throttle input acks.
709 base::TimeDelta total_input_handling_time_this_frame_; 712 base::TimeDelta total_input_handling_time_this_frame_;
710 713
711 // Properties of the screen hosting this RenderWidget instance. 714 // Properties of the screen hosting this RenderWidget instance.
712 blink::WebScreenInfo screen_info_; 715 blink::WebScreenInfo screen_info_;
713 716
714 // The device scale factor. This value is computed from the DPI entries in 717 // The device scale factor. This value is computed from the DPI entries in
715 // |screen_info_| on some platforms, and defaults to 1 on other platforms. 718 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
716 float device_scale_factor_; 719 float device_scale_factor_;
(...skipping 14 matching lines...) Expand all
731 // by script etc., not by user input. 734 // by script etc., not by user input.
732 bool text_field_is_dirty_; 735 bool text_field_is_dirty_;
733 736
734 // Stores the history of text input infos from the last ACK'ed one from the 737 // Stores the history of text input infos from the last ACK'ed one from the
735 // current one. The size is the number of pending ACKs plus one, since we 738 // current one. The size is the number of pending ACKs plus one, since we
736 // intentionally keep the last ack'd value to know what the browser is 739 // intentionally keep the last ack'd value to know what the browser is
737 // currently aware of. 740 // currently aware of.
738 std::deque<blink::WebTextInputInfo> text_input_info_history_; 741 std::deque<blink::WebTextInputInfo> text_input_info_history_;
739 #endif 742 #endif
740 743
741 scoped_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_; 744 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
742 745
743 // Popups may be displaced when screen metrics emulation is enabled. 746 // Popups may be displaced when screen metrics emulation is enabled.
744 // These values are used to properly adjust popup position. 747 // These values are used to properly adjust popup position.
745 gfx::Point popup_view_origin_for_emulation_; 748 gfx::Point popup_view_origin_for_emulation_;
746 gfx::Point popup_screen_origin_for_emulation_; 749 gfx::Point popup_screen_origin_for_emulation_;
747 float popup_origin_scale_for_emulation_; 750 float popup_origin_scale_for_emulation_;
748 751
749 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; 752 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
750 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; 753 std::unique_ptr<ResizingModeSelector> resizing_mode_selector_;
751 754
752 // Lists of RenderFrameProxy objects that need to be notified of 755 // Lists of RenderFrameProxy objects that need to be notified of
753 // compositing-related events (e.g. DidCommitCompositorFrame). 756 // compositing-related events (e.g. DidCommitCompositorFrame).
754 base::ObserverList<RenderFrameProxy> render_frame_proxies_; 757 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
755 #if defined(VIDEO_HOLE) 758 #if defined(VIDEO_HOLE)
756 base::ObserverList<RenderFrameImpl> video_hole_frames_; 759 base::ObserverList<RenderFrameImpl> video_hole_frames_;
757 #endif // defined(VIDEO_HOLE) 760 #endif // defined(VIDEO_HOLE)
758 761
759 // A list of RenderFrames associated with this RenderWidget. Notifications 762 // A list of RenderFrames associated with this RenderWidget. Notifications
760 // are sent to each frame in the list for events such as changing 763 // are sent to each frame in the list for events such as changing
761 // visibility state for example. 764 // visibility state for example.
762 base::ObserverList<RenderFrameImpl> render_frames_; 765 base::ObserverList<RenderFrameImpl> render_frames_;
763 766
764 bool has_host_context_menu_location_; 767 bool has_host_context_menu_location_;
765 gfx::Point host_context_menu_location_; 768 gfx::Point host_context_menu_location_;
766 769
767 scoped_ptr<scheduler::RenderWidgetSchedulingState> 770 std::unique_ptr<scheduler::RenderWidgetSchedulingState>
768 render_widget_scheduling_state_; 771 render_widget_scheduling_state_;
769 772
770 private: 773 private:
771 // When emulated, this returns original device scale factor. 774 // When emulated, this returns original device scale factor.
772 float GetOriginalDeviceScaleFactor() const; 775 float GetOriginalDeviceScaleFactor() const;
773 776
774 DISALLOW_COPY_AND_ASSIGN(RenderWidget); 777 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
775 }; 778 };
776 779
777 } // namespace content 780 } // namespace content
778 781
779 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ 782 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698