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_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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 return frame_subscriber_.get(); | 353 return frame_subscriber_.get(); |
354 } | 354 } |
355 | 355 |
356 virtual bool ShouldCreateResizeLock(); | 356 virtual bool ShouldCreateResizeLock(); |
357 virtual scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock); | 357 virtual scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock); |
358 | 358 |
359 virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); | 359 virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); |
360 | 360 |
361 // Exposed for tests. | 361 // Exposed for tests. |
362 aura::Window* window() { return window_; } | 362 aura::Window* window() { return window_; } |
363 gfx::Size current_frame_size() const { return current_frame_size_; } | 363 gfx::Size current_frame_size_in_dip() const { |
| 364 return current_frame_size_in_dip_; |
| 365 } |
364 void LockResources(); | 366 void LockResources(); |
365 void UnlockResources(); | 367 void UnlockResources(); |
366 | 368 |
367 // Overridden from ui::CompositorObserver: | 369 // Overridden from ui::CompositorObserver: |
368 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE; | 370 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE; |
369 virtual void OnCompositingStarted(ui::Compositor* compositor, | 371 virtual void OnCompositingStarted(ui::Compositor* compositor, |
370 base::TimeTicks start_time) OVERRIDE; | 372 base::TimeTicks start_time) OVERRIDE; |
371 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; | 373 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; |
372 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE; | 374 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE; |
373 virtual void OnCompositingLockStateChanged( | 375 virtual void OnCompositingLockStateChanged( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // space is required by the aura::Window. | 422 // space is required by the aura::Window. |
421 void InternalSetBounds(const gfx::Rect& rect); | 423 void InternalSetBounds(const gfx::Rect& rect); |
422 | 424 |
423 // Lazily grab a resize lock if the aura window size doesn't match the current | 425 // Lazily grab a resize lock if the aura window size doesn't match the current |
424 // frame size, to give time to the renderer. | 426 // frame size, to give time to the renderer. |
425 void MaybeCreateResizeLock(); | 427 void MaybeCreateResizeLock(); |
426 | 428 |
427 // Checks if the resize lock can be released because we received an new frame. | 429 // Checks if the resize lock can be released because we received an new frame. |
428 void CheckResizeLock(); | 430 void CheckResizeLock(); |
429 | 431 |
430 void UpdateExternalTexture(); | |
431 ui::InputMethod* GetInputMethod() const; | 432 ui::InputMethod* GetInputMethod() const; |
432 | 433 |
433 // Returns whether the widget needs an input grab to work properly. | 434 // Returns whether the widget needs an input grab to work properly. |
434 bool NeedsInputGrab(); | 435 bool NeedsInputGrab(); |
435 | 436 |
436 // Confirm existing composition text in the webpage and ask the input method | 437 // Confirm existing composition text in the webpage and ask the input method |
437 // to cancel its ongoing composition session. | 438 // to cancel its ongoing composition session. |
438 void FinishImeCompositionSession(); | 439 void FinishImeCompositionSession(); |
439 | 440 |
440 // This method computes movementX/Y and keeps track of mouse location for | 441 // This method computes movementX/Y and keeps track of mouse location for |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // Dismisses a Web Popup on a mouse or touch press outside the popup and its | 511 // Dismisses a Web Popup on a mouse or touch press outside the popup and its |
511 // parent. | 512 // parent. |
512 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event); | 513 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event); |
513 | 514 |
514 // Converts |rect| from window coordinate to screen coordinate. | 515 // Converts |rect| from window coordinate to screen coordinate. |
515 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const; | 516 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const; |
516 | 517 |
517 // Converts |rect| from screen coordinate to window coordinate. | 518 // Converts |rect| from screen coordinate to window coordinate. |
518 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; | 519 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; |
519 | 520 |
520 typedef base::Callback<void(bool, const scoped_refptr<ui::Texture>&)> | |
521 BufferPresentedCallback; | |
522 | |
523 // The common entry point for buffer updates from renderer | |
524 // and GPU process. | |
525 void BuffersSwapped(const gfx::Size& surface_size, | |
526 const gfx::Rect& damage_rect, | |
527 float surface_scale_factor, | |
528 const std::string& mailbox_name, | |
529 const std::vector<ui::LatencyInfo>& latency_info, | |
530 const BufferPresentedCallback& ack_callback); | |
531 | |
532 bool SwapBuffersPrepare(const gfx::Rect& surface_rect, | |
533 float surface_scale_factor, | |
534 const gfx::Rect& damage_rect, | |
535 const std::string& mailbox_name, | |
536 const BufferPresentedCallback& ack_callback); | |
537 | |
538 void SwapBuffersCompleted( | |
539 const BufferPresentedCallback& ack_callback, | |
540 const scoped_refptr<ui::Texture>& texture_to_return); | |
541 | |
542 void SwapDelegatedFrame( | 521 void SwapDelegatedFrame( |
543 uint32 output_surface_id, | 522 uint32 output_surface_id, |
544 scoped_ptr<cc::DelegatedFrameData> frame_data, | 523 scoped_ptr<cc::DelegatedFrameData> frame_data, |
545 float frame_device_scale_factor, | 524 float frame_device_scale_factor, |
546 const std::vector<ui::LatencyInfo>& latency_info); | 525 const std::vector<ui::LatencyInfo>& latency_info); |
547 void SendDelegatedFrameAck(uint32 output_surface_id); | 526 void SendDelegatedFrameAck(uint32 output_surface_id); |
548 void SendReturnedDelegatedResources(uint32 output_surface_id); | 527 void SendReturnedDelegatedResources(uint32 output_surface_id); |
549 | 528 |
550 // DelegatedFrameEvictorClient implementation. | 529 // DelegatedFrameEvictorClient implementation. |
551 virtual void EvictDelegatedFrame() OVERRIDE; | 530 virtual void EvictDelegatedFrame() OVERRIDE; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 bool has_composition_text_; | 602 bool has_composition_text_; |
624 | 603 |
625 // Whether return characters should be passed on to the RenderWidgetHostImpl. | 604 // Whether return characters should be passed on to the RenderWidgetHostImpl. |
626 bool accept_return_character_; | 605 bool accept_return_character_; |
627 | 606 |
628 // Current tooltip text. | 607 // Current tooltip text. |
629 base::string16 tooltip_; | 608 base::string16 tooltip_; |
630 | 609 |
631 std::vector<base::Closure> on_compositing_did_commit_callbacks_; | 610 std::vector<base::Closure> on_compositing_did_commit_callbacks_; |
632 | 611 |
633 // The current frontbuffer texture. | |
634 scoped_refptr<ui::Texture> current_surface_; | |
635 | |
636 // This holds the current software framebuffer, if any. | 612 // This holds the current software framebuffer, if any. |
637 scoped_ptr<SoftwareFrameManager> software_frame_manager_; | 613 scoped_ptr<SoftwareFrameManager> software_frame_manager_; |
638 | 614 |
639 // With delegated renderer, this is the last output surface, used to | 615 // With delegated renderer, this is the last output surface, used to |
640 // disambiguate resources with the same id coming from different output | 616 // disambiguate resources with the same id coming from different output |
641 // surfaces. | 617 // surfaces. |
642 uint32 last_output_surface_id_; | 618 uint32 last_output_surface_id_; |
643 | 619 |
644 // The number of delegated frame acks that are pending, to delay resource | 620 // The number of delegated frame acks that are pending, to delay resource |
645 // returns until the acks are sent. | 621 // returns until the acks are sent. |
646 int pending_delegated_ack_count_; | 622 int pending_delegated_ack_count_; |
647 | 623 |
648 // The damage in the previously presented buffer. | |
649 SkRegion previous_damage_; | |
650 | |
651 // Pending damage from previous frames that we skipped. | |
652 SkRegion skipped_damage_; | |
653 | |
654 // True after a delegated frame has been skipped, until a frame is not | 624 // True after a delegated frame has been skipped, until a frame is not |
655 // skipped. | 625 // skipped. |
656 bool skipped_frames_; | 626 bool skipped_frames_; |
657 | 627 |
658 // Holds delegated resources that have been given to a DelegatedFrameProvider, | 628 // Holds delegated resources that have been given to a DelegatedFrameProvider, |
659 // and gives back resources when they are no longer in use for return to the | 629 // and gives back resources when they are no longer in use for return to the |
660 // renderer. | 630 // renderer. |
661 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; | 631 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
662 | 632 |
663 // Provides delegated frame updates to the cc::DelegatedRendererLayer. | 633 // Provides delegated frame updates to the cc::DelegatedRendererLayer. |
664 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; | 634 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
665 | 635 |
666 // The size of the last frame that was swapped (even if we skipped it). | 636 // The size and scale of the last software compositing frame that was swapped. |
667 // Used to determine when the skipped_damage_ needs to be reset due to | 637 gfx::Size last_swapped_software_frame_size_; |
668 // size changes between front- and backbuffer. | 638 float last_swapped_software_frame_scale_factor_; |
669 gfx::Size last_swapped_surface_size_; | |
670 float last_swapped_surface_scale_factor_; | |
671 | 639 |
672 // If non-NULL we're in OnPaint() and this is the supplied canvas. | 640 // If non-NULL we're in OnPaint() and this is the supplied canvas. |
673 gfx::Canvas* paint_canvas_; | 641 gfx::Canvas* paint_canvas_; |
674 | 642 |
675 // Used to record the last position of the mouse. | 643 // Used to record the last position of the mouse. |
676 // While the mouse is locked, they store the last known position just as mouse | 644 // While the mouse is locked, they store the last known position just as mouse |
677 // lock was entered. | 645 // lock was entered. |
678 // Relative to the upper-left corner of the view. | 646 // Relative to the upper-left corner of the view. |
679 gfx::Point unlocked_mouse_position_; | 647 gfx::Point unlocked_mouse_position_; |
680 // Relative to the upper-left corner of the screen. | 648 // Relative to the upper-left corner of the screen. |
681 gfx::Point unlocked_global_mouse_position_; | 649 gfx::Point unlocked_global_mouse_position_; |
682 // Last cursor position relative to screen. Used to compute movementX/Y. | 650 // Last cursor position relative to screen. Used to compute movementX/Y. |
683 gfx::Point global_mouse_position_; | 651 gfx::Point global_mouse_position_; |
684 // In mouse locked mode, we syntheticaly move the mouse cursor to the center | 652 // In mouse locked mode, we syntheticaly move the mouse cursor to the center |
685 // of the window when it reaches the window borders to avoid it going outside. | 653 // of the window when it reaches the window borders to avoid it going outside. |
686 // This flag is used to differentiate between these synthetic mouse move | 654 // This flag is used to differentiate between these synthetic mouse move |
687 // events vs. normal mouse move events. | 655 // events vs. normal mouse move events. |
688 bool synthetic_move_sent_; | 656 bool synthetic_move_sent_; |
689 | 657 |
690 // Signals that the accelerated compositing has been turned on or off. | |
691 // This is used to signal to turn off the external texture as soon as the | |
692 // software backing store is updated. | |
693 bool accelerated_compositing_state_changed_; | |
694 | |
695 // This lock is the one waiting for a frame of the right size to come back | 658 // This lock is the one waiting for a frame of the right size to come back |
696 // from the renderer/GPU process. It is set from the moment the aura window | 659 // from the renderer/GPU process. It is set from the moment the aura window |
697 // got resized, to the moment we committed the renderer frame of the same | 660 // got resized, to the moment we committed the renderer frame of the same |
698 // size. It keeps track of the size we expect from the renderer, and locks the | 661 // size. It keeps track of the size we expect from the renderer, and locks the |
699 // compositor, as well as the UI for a short time to give a chance to the | 662 // compositor, as well as the UI for a short time to give a chance to the |
700 // renderer of producing a frame of the right size. | 663 // renderer of producing a frame of the right size. |
701 scoped_ptr<ResizeLock> resize_lock_; | 664 scoped_ptr<ResizeLock> resize_lock_; |
702 | 665 |
703 // Keeps track of the current frame size. | 666 // Keeps track of the current frame size. |
704 gfx::Size current_frame_size_; | 667 gfx::Size current_frame_size_in_dip_; |
705 | 668 |
706 // This lock is for waiting for a front surface to become available to draw. | 669 // This lock is for waiting for a front surface to become available to draw. |
707 scoped_refptr<ui::CompositorLock> released_front_lock_; | 670 scoped_refptr<ui::CompositorLock> released_front_lock_; |
708 | 671 |
709 // Used to track the state of the window we're created from. Only used when | 672 // Used to track the state of the window we're created from. Only used when |
710 // created fullscreen. | 673 // created fullscreen. |
711 scoped_ptr<aura::WindowTracker> host_tracker_; | 674 scoped_ptr<aura::WindowTracker> host_tracker_; |
712 | 675 |
713 enum CanLockCompositorState { | 676 enum CanLockCompositorState { |
714 YES, | 677 YES, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 // etc. | 741 // etc. |
779 scoped_ptr<content::LegacyRenderWidgetHostHWND> | 742 scoped_ptr<content::LegacyRenderWidgetHostHWND> |
780 legacy_render_widget_host_HWND_; | 743 legacy_render_widget_host_HWND_; |
781 #endif | 744 #endif |
782 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 745 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
783 }; | 746 }; |
784 | 747 |
785 } // namespace content | 748 } // namespace content |
786 | 749 |
787 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 750 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |