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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.h

Issue 423773002: Unified BeginFrame scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working on aura with --enable-begin-frame-scheduling Created 6 years, 4 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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 10 matching lines...) Expand all
21 #include "content/browser/compositor/image_transport_factory.h" 21 #include "content/browser/compositor/image_transport_factory.h"
22 #include "content/browser/compositor/owned_mailbox.h" 22 #include "content/browser/compositor/owned_mailbox.h"
23 #include "content/browser/renderer_host/render_widget_host_view_base.h" 23 #include "content/browser/renderer_host/render_widget_host_view_base.h"
24 #include "content/common/content_export.h" 24 #include "content/common/content_export.h"
25 #include "content/common/cursors/webcursor.h" 25 #include "content/common/cursors/webcursor.h"
26 #include "third_party/skia/include/core/SkRegion.h" 26 #include "third_party/skia/include/core/SkRegion.h"
27 #include "ui/aura/client/cursor_client_observer.h" 27 #include "ui/aura/client/cursor_client_observer.h"
28 #include "ui/aura/client/focus_change_observer.h" 28 #include "ui/aura/client/focus_change_observer.h"
29 #include "ui/aura/window_delegate.h" 29 #include "ui/aura/window_delegate.h"
30 #include "ui/aura/window_tree_host_observer.h" 30 #include "ui/aura/window_tree_host_observer.h"
31 #include "ui/base/compositor/begin_frame_manager.h"
31 #include "ui/base/ime/text_input_client.h" 32 #include "ui/base/ime/text_input_client.h"
32 #include "ui/gfx/display_observer.h" 33 #include "ui/gfx/display_observer.h"
33 #include "ui/gfx/insets.h" 34 #include "ui/gfx/insets.h"
34 #include "ui/gfx/rect.h" 35 #include "ui/gfx/rect.h"
35 #include "ui/wm/public/activation_change_observer.h" 36 #include "ui/wm/public/activation_change_observer.h"
36 #include "ui/wm/public/activation_delegate.h" 37 #include "ui/wm/public/activation_delegate.h"
37 38
38 struct ViewHostMsg_TextInputState_Params; 39 struct ViewHostMsg_TextInputState_Params;
39 40
40 namespace aura { 41 namespace aura {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 : public RenderWidgetHostViewBase, 82 : public RenderWidgetHostViewBase,
82 public DelegatedFrameHostClient, 83 public DelegatedFrameHostClient,
83 public ui::TextInputClient, 84 public ui::TextInputClient,
84 public gfx::DisplayObserver, 85 public gfx::DisplayObserver,
85 public aura::WindowTreeHostObserver, 86 public aura::WindowTreeHostObserver,
86 public aura::WindowDelegate, 87 public aura::WindowDelegate,
87 public aura::client::ActivationDelegate, 88 public aura::client::ActivationDelegate,
88 public aura::client::ActivationChangeObserver, 89 public aura::client::ActivationChangeObserver,
89 public aura::client::FocusChangeObserver, 90 public aura::client::FocusChangeObserver,
90 public aura::client::CursorClientObserver, 91 public aura::client::CursorClientObserver,
92 public ui::BeginFrameManager::Observer,
brianderson 2014/08/21 00:14:00 Is the plan to land this first as Aura-only and th
simonhong 2014/08/26 08:24:48 I'll implement mac and android also in this CL, th
91 public base::SupportsWeakPtr<RenderWidgetHostViewAura> { 93 public base::SupportsWeakPtr<RenderWidgetHostViewAura> {
92 public: 94 public:
93 // Displays and controls touch editing elements such as selection handles. 95 // Displays and controls touch editing elements such as selection handles.
94 class TouchEditingClient { 96 class TouchEditingClient {
95 public: 97 public:
96 TouchEditingClient() {} 98 TouchEditingClient() {}
97 99
98 // Tells the client to start showing touch editing handles. 100 // Tells the client to start showing touch editing handles.
99 virtual void StartTouchEditing() = 0; 101 virtual void StartTouchEditing() = 0;
100 102
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; 145 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
144 virtual void Show() OVERRIDE; 146 virtual void Show() OVERRIDE;
145 virtual void Hide() OVERRIDE; 147 virtual void Hide() OVERRIDE;
146 virtual bool IsShowing() OVERRIDE; 148 virtual bool IsShowing() OVERRIDE;
147 virtual gfx::Rect GetViewBounds() const OVERRIDE; 149 virtual gfx::Rect GetViewBounds() const OVERRIDE;
148 virtual void SetBackgroundOpaque(bool opaque) OVERRIDE; 150 virtual void SetBackgroundOpaque(bool opaque) OVERRIDE;
149 virtual gfx::Size GetVisibleViewportSize() const OVERRIDE; 151 virtual gfx::Size GetVisibleViewportSize() const OVERRIDE;
150 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; 152 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE;
151 153
152 // Overridden from RenderWidgetHostViewBase: 154 // Overridden from RenderWidgetHostViewBase:
155 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
153 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, 156 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
154 const gfx::Rect& pos) OVERRIDE; 157 const gfx::Rect& pos) OVERRIDE;
155 virtual void InitAsFullscreen( 158 virtual void InitAsFullscreen(
156 RenderWidgetHostView* reference_host_view) OVERRIDE; 159 RenderWidgetHostView* reference_host_view) OVERRIDE;
157 virtual void WasShown() OVERRIDE; 160 virtual void WasShown() OVERRIDE;
158 virtual void WasHidden() OVERRIDE; 161 virtual void WasHidden() OVERRIDE;
159 virtual void MovePluginWindows( 162 virtual void MovePluginWindows(
160 const std::vector<WebPluginGeometry>& moves) OVERRIDE; 163 const std::vector<WebPluginGeometry>& moves) OVERRIDE;
161 virtual void Focus() OVERRIDE; 164 virtual void Focus() OVERRIDE;
162 virtual void Blur() OVERRIDE; 165 virtual void Blur() OVERRIDE;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 virtual void OnCursorVisibilityChanged(bool is_visible) OVERRIDE; 315 virtual void OnCursorVisibilityChanged(bool is_visible) OVERRIDE;
313 316
314 // Overridden from aura::client::FocusChangeObserver: 317 // Overridden from aura::client::FocusChangeObserver:
315 virtual void OnWindowFocused(aura::Window* gained_focus, 318 virtual void OnWindowFocused(aura::Window* gained_focus,
316 aura::Window* lost_focus) OVERRIDE; 319 aura::Window* lost_focus) OVERRIDE;
317 320
318 // Overridden from aura::WindowTreeHostObserver: 321 // Overridden from aura::WindowTreeHostObserver:
319 virtual void OnHostMoved(const aura::WindowTreeHost* host, 322 virtual void OnHostMoved(const aura::WindowTreeHost* host,
320 const gfx::Point& new_origin) OVERRIDE; 323 const gfx::Point& new_origin) OVERRIDE;
321 324
325 // Overridden from ui::BeginFrameManager::Observer:
326 virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) OVERRIDE;
327
322 #if defined(OS_WIN) 328 #if defined(OS_WIN)
323 // Sets the cutout rects from constrained windows. These are rectangles that 329 // Sets the cutout rects from constrained windows. These are rectangles that
324 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout 330 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
325 // rects. 331 // rects.
326 void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects); 332 void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
327 333
328 // Updates the cursor clip region. Used for mouse locking. 334 // Updates the cursor clip region. Used for mouse locking.
329 void UpdateMouseLockRegion(); 335 void UpdateMouseLockRegion();
330 336
331 // Notification that the LegacyRenderWidgetHostHWND was destroyed. 337 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
332 void OnLegacyWindowDestroyed(); 338 void OnLegacyWindowDestroyed();
333 #endif 339 #endif
334 340
335 // Method to indicate if this instance is shutting down or closing. 341 // Method to indicate if this instance is shutting down or closing.
336 // TODO(shrikant): Discuss around to see if it makes sense to add this method 342 // TODO(shrikant): Discuss around to see if it makes sense to add this method
337 // as part of RenderWidgetHostView. 343 // as part of RenderWidgetHostView.
338 bool IsClosing() const { return in_shutdown_; } 344 bool IsClosing() const { return in_shutdown_; }
339 345
340 // Sets whether the overscroll controller should be enabled for this page. 346 // Sets whether the overscroll controller should be enabled for this page.
341 void SetOverscrollControllerEnabled(bool enabled); 347 void SetOverscrollControllerEnabled(bool enabled);
342 348
343 void SnapToPhysicalPixelBoundary(); 349 void SnapToPhysicalPixelBoundary();
344 350
345 OverscrollController* overscroll_controller() const { 351 OverscrollController* overscroll_controller() const {
346 return overscroll_controller_.get(); 352 return overscroll_controller_.get();
347 } 353 }
348 354
355 // Request next BeginFrame to compositor.
356 void RequestBeginFrame() const;
357
349 protected: 358 protected:
350 virtual ~RenderWidgetHostViewAura(); 359 virtual ~RenderWidgetHostViewAura();
351 360
352 // Exposed for tests. 361 // Exposed for tests.
353 aura::Window* window() { return window_; } 362 aura::Window* window() { return window_; }
354 virtual SkColorType PreferredReadbackFormat() OVERRIDE; 363 virtual SkColorType PreferredReadbackFormat() OVERRIDE;
355 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; 364 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE;
356 365
357 private: 366 private:
358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); 367 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 465
457 // Converts |rect| from window coordinate to screen coordinate. 466 // Converts |rect| from window coordinate to screen coordinate.
458 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const; 467 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
459 468
460 // Converts |rect| from screen coordinate to window coordinate. 469 // Converts |rect| from screen coordinate to window coordinate.
461 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; 470 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
462 471
463 // Helper function to set keyboard focus to the main window. 472 // Helper function to set keyboard focus to the main window.
464 void SetKeyboardFocus(); 473 void SetKeyboardFocus();
465 474
475 void OnSetNeedsBeginFrame(bool enabled);
476
466 RenderFrameHostImpl* GetFocusedFrame(); 477 RenderFrameHostImpl* GetFocusedFrame();
467 478
468 // The model object. 479 // The model object.
469 RenderWidgetHostImpl* host_; 480 RenderWidgetHostImpl* host_;
470 481
471 aura::Window* window_; 482 aura::Window* window_;
472 483
473 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; 484 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
474 485
475 scoped_ptr<WindowObserver> window_observer_; 486 scoped_ptr<WindowObserver> window_observer_;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // DestroyWindow for e.g. This flag helps ensure that we don't try to create 600 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
590 // the LegacyRenderWidgetHostHWND instance again as that would be a futile 601 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
591 // exercise. 602 // exercise.
592 bool legacy_window_destroyed_; 603 bool legacy_window_destroyed_;
593 #endif 604 #endif
594 605
595 bool has_snapped_to_boundary_; 606 bool has_snapped_to_boundary_;
596 607
597 TouchEditingClient* touch_editing_client_; 608 TouchEditingClient* touch_editing_client_;
598 609
610 // true when RenderWidget needs a BeginFrame.
611 bool needs_begin_frame_;
612
599 scoped_ptr<OverscrollController> overscroll_controller_; 613 scoped_ptr<OverscrollController> overscroll_controller_;
600 614
601 gfx::Insets insets_; 615 gfx::Insets insets_;
602 616
603 std::vector<ui::LatencyInfo> software_latency_info_; 617 std::vector<ui::LatencyInfo> software_latency_info_;
604 618
605 scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_; 619 scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
606 620
607 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; 621 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
608 622
609 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 623 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
610 }; 624 };
611 625
612 } // namespace content 626 } // namespace content
613 627
614 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 628 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698