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

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

Issue 240163005: Deliver IPC messages together with SwapCompositorFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback + add more testing Created 6 years, 6 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 | Annotate | Revision Log
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 <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 10
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/observer_list.h" 17 #include "base/observer_list.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
19 #include "cc/debug/rendering_stats_instrumentation.h" 20 #include "cc/debug/rendering_stats_instrumentation.h"
20 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
21 #include "content/common/cursors/webcursor.h" 22 #include "content/common/cursors/webcursor.h"
22 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 23 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
23 #include "content/common/input/synthetic_gesture_params.h" 24 #include "content/common/input/synthetic_gesture_params.h"
25 #include "content/renderer/message_delivery_policy.h"
24 #include "ipc/ipc_listener.h" 26 #include "ipc/ipc_listener.h"
25 #include "ipc/ipc_sender.h" 27 #include "ipc/ipc_sender.h"
26 #include "third_party/WebKit/public/platform/WebRect.h" 28 #include "third_party/WebKit/public/platform/WebRect.h"
27 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 29 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
28 #include "third_party/WebKit/public/web/WebInputEvent.h" 30 #include "third_party/WebKit/public/web/WebInputEvent.h"
29 #include "third_party/WebKit/public/web/WebPopupType.h" 31 #include "third_party/WebKit/public/web/WebPopupType.h"
30 #include "third_party/WebKit/public/web/WebTextDirection.h" 32 #include "third_party/WebKit/public/web/WebTextDirection.h"
31 #include "third_party/WebKit/public/web/WebTextInputInfo.h" 33 #include "third_party/WebKit/public/web/WebTextInputInfo.h"
32 #include "third_party/WebKit/public/web/WebTouchAction.h" 34 #include "third_party/WebKit/public/web/WebTouchAction.h"
33 #include "third_party/WebKit/public/web/WebWidget.h" 35 #include "third_party/WebKit/public/web/WebWidget.h"
34 #include "third_party/WebKit/public/web/WebWidgetClient.h" 36 #include "third_party/WebKit/public/web/WebWidgetClient.h"
35 #include "third_party/skia/include/core/SkBitmap.h" 37 #include "third_party/skia/include/core/SkBitmap.h"
36 #include "ui/base/ime/text_input_mode.h" 38 #include "ui/base/ime/text_input_mode.h"
37 #include "ui/base/ime/text_input_type.h" 39 #include "ui/base/ime/text_input_type.h"
38 #include "ui/base/ui_base_types.h" 40 #include "ui/base/ui_base_types.h"
39 #include "ui/gfx/native_widget_types.h" 41 #include "ui/gfx/native_widget_types.h"
40 #include "ui/gfx/range/range.h" 42 #include "ui/gfx/range/range.h"
41 #include "ui/gfx/rect.h" 43 #include "ui/gfx/rect.h"
42 #include "ui/gfx/vector2d.h" 44 #include "ui/gfx/vector2d.h"
43 #include "ui/gfx/vector2d_f.h" 45 #include "ui/gfx/vector2d_f.h"
44 #include "ui/surface/transport_dib.h" 46 #include "ui/surface/transport_dib.h"
45 47
46 struct ViewHostMsg_UpdateRect_Params; 48 struct ViewHostMsg_UpdateRect_Params;
47 struct ViewMsg_Resize_Params; 49 struct ViewMsg_Resize_Params;
48 class ViewHostMsg_UpdateRect; 50 class ViewHostMsg_UpdateRect;
49 51
50 namespace IPC { 52 namespace IPC {
51 class SyncMessage; 53 class SyncMessage;
54 class SyncMessageFilter;
52 } 55 }
53 56
54 namespace blink { 57 namespace blink {
55 struct WebDeviceEmulationParams; 58 struct WebDeviceEmulationParams;
56 class WebGestureEvent; 59 class WebGestureEvent;
57 class WebKeyboardEvent; 60 class WebKeyboardEvent;
58 class WebMouseEvent; 61 class WebMouseEvent;
59 class WebTouchEvent; 62 class WebTouchEvent;
60 } 63 }
61 64
62 namespace cc { class OutputSurface; } 65 namespace cc {
66 class OutputSurface;
67 class SwapPromise;
68 }
63 69
64 namespace gfx { 70 namespace gfx {
65 class Range; 71 class Range;
66 } 72 }
67 73
68 namespace content { 74 namespace content {
69 class ExternalPopupMenu; 75 class ExternalPopupMenu;
76 class FrameSwapMessageQueue;
70 class PepperPluginInstanceImpl; 77 class PepperPluginInstanceImpl;
71 class RenderFrameImpl; 78 class RenderFrameImpl;
72 class RenderFrameProxy; 79 class RenderFrameProxy;
73 class RenderWidgetCompositor; 80 class RenderWidgetCompositor;
74 class RenderWidgetTest; 81 class RenderWidgetTest;
75 class ResizingModeSelector; 82 class ResizingModeSelector;
76 struct ContextMenuParams; 83 struct ContextMenuParams;
77 struct WebPluginGeometry; 84 struct WebPluginGeometry;
78 85
79 // RenderWidget provides a communication bridge between a WebWidget and 86 // RenderWidget provides a communication bridge between a WebWidget and
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 void QueueSyntheticGesture( 192 void QueueSyntheticGesture(
186 scoped_ptr<SyntheticGestureParams> gesture_params, 193 scoped_ptr<SyntheticGestureParams> gesture_params,
187 const SyntheticGestureCompletionCallback& callback); 194 const SyntheticGestureCompletionCallback& callback);
188 195
189 // Close the underlying WebWidget. 196 // Close the underlying WebWidget.
190 virtual void Close(); 197 virtual void Close();
191 198
192 // Notifies about a compositor frame commit operation having finished. 199 // Notifies about a compositor frame commit operation having finished.
193 virtual void DidCommitCompositorFrame(); 200 virtual void DidCommitCompositorFrame();
194 201
202 // Deliveres |message| together with compositor state change updates. The
203 // exact behavior depends on |policy|.
204 //
205 // |msg| message to send, ownership of |msg| is transferred.
206 // |policy| see the comment on MessageDeliveryPolicy.
207 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
208
195 // Handle common setup/teardown for handling IME events. 209 // Handle common setup/teardown for handling IME events.
196 void StartHandlingImeEvent(); 210 void StartHandlingImeEvent();
197 void FinishHandlingImeEvent(); 211 void FinishHandlingImeEvent();
198 212
199 // Returns whether we currently should handle an IME event. 213 // Returns whether we currently should handle an IME event.
200 bool ShouldHandleImeEvent(); 214 bool ShouldHandleImeEvent();
201 215
202 virtual void InstrumentWillBeginFrame(int frame_id) {} 216 virtual void InstrumentWillBeginFrame(int frame_id) {}
203 virtual void InstrumentDidBeginFrame() {} 217 virtual void InstrumentDidBeginFrame() {}
204 virtual void InstrumentDidCancelFrame() {} 218 virtual void InstrumentDidCancelFrame() {}
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // state. 426 // state.
413 void SetHidden(bool hidden); 427 void SetHidden(bool hidden);
414 428
415 void WillToggleFullscreen(); 429 void WillToggleFullscreen();
416 void DidToggleFullscreen(); 430 void DidToggleFullscreen();
417 431
418 bool next_paint_is_resize_ack() const; 432 bool next_paint_is_resize_ack() const;
419 void set_next_paint_is_resize_ack(); 433 void set_next_paint_is_resize_ack();
420 void set_next_paint_is_repaint_ack(); 434 void set_next_paint_is_repaint_ack();
421 435
436 // QueueMessage implementation extracted into a static method for easy
437 // testing.
438 static scoped_ptr<cc::SwapPromise> QueueMessageImpl(
439 IPC::Message* msg,
440 MessageDeliveryPolicy policy,
441 FrameSwapMessageQueue* frame_swap_message_queue,
442 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
443 bool commit_requested,
444 int source_frame_number);
445
422 // Override point to obtain that the current input method state and caret 446 // Override point to obtain that the current input method state and caret
423 // position. 447 // position.
424 virtual ui::TextInputType GetTextInputType(); 448 virtual ui::TextInputType GetTextInputType();
425 virtual ui::TextInputType WebKitToUiTextInputType( 449 virtual ui::TextInputType WebKitToUiTextInputType(
426 blink::WebTextInputType type); 450 blink::WebTextInputType type);
427 451
428 #if defined(OS_MACOSX) || defined(USE_AURA) 452 #if defined(OS_MACOSX) || defined(USE_AURA)
429 // Override point to obtain that the current composition character bounds. 453 // Override point to obtain that the current composition character bounds.
430 // In the case of surrogate pairs, the character is treated as two characters: 454 // In the case of surrogate pairs, the character is treated as two characters:
431 // the bounds for first character is actual one, and the bounds for second 455 // the bounds for first character is actual one, and the bounds for second
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 #endif 708 #endif
685 709
686 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_; 710 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_;
687 711
688 // Popups may be displaced when screen metrics emulation is enabled. 712 // Popups may be displaced when screen metrics emulation is enabled.
689 // These values are used to properly adjust popup position. 713 // These values are used to properly adjust popup position.
690 gfx::Point popup_view_origin_for_emulation_; 714 gfx::Point popup_view_origin_for_emulation_;
691 gfx::Point popup_screen_origin_for_emulation_; 715 gfx::Point popup_screen_origin_for_emulation_;
692 float popup_origin_scale_for_emulation_; 716 float popup_origin_scale_for_emulation_;
693 717
718 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
694 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; 719 scoped_ptr<ResizingModeSelector> resizing_mode_selector_;
695 720
696 // Lists of RenderFrameProxy objects that need to be notified of 721 // Lists of RenderFrameProxy objects that need to be notified of
697 // compositing-related events (e.g. DidCommitCompositorFrame). 722 // compositing-related events (e.g. DidCommitCompositorFrame).
698 ObserverList<RenderFrameProxy> render_frame_proxies_; 723 ObserverList<RenderFrameProxy> render_frame_proxies_;
699 #if defined(VIDEO_HOLE) 724 #if defined(VIDEO_HOLE)
700 ObserverList<RenderFrameImpl> video_hole_frames_; 725 ObserverList<RenderFrameImpl> video_hole_frames_;
701 #endif // defined(VIDEO_HOLE) 726 #endif // defined(VIDEO_HOLE)
702 727
703 // A list of RenderFrames associated with this RenderWidget. Notifications 728 // A list of RenderFrames associated with this RenderWidget. Notifications
704 // are sent to each frame in the list for events such as changing 729 // are sent to each frame in the list for events such as changing
705 // visibility state for example. 730 // visibility state for example.
706 ObserverList<RenderFrameImpl> render_frames_; 731 ObserverList<RenderFrameImpl> render_frames_;
707 732
708 ui::MenuSourceType context_menu_source_type_; 733 ui::MenuSourceType context_menu_source_type_;
709 gfx::Point touch_editing_context_menu_location_; 734 gfx::Point touch_editing_context_menu_location_;
710 735
711 DISALLOW_COPY_AND_ASSIGN(RenderWidget); 736 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
712 }; 737 };
713 738
714 } // namespace content 739 } // namespace content
715 740
716 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ 741 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698