| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { | 367 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { |
| 368 return frame_subscriber_.get(); | 368 return frame_subscriber_.get(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 virtual bool ShouldCreateResizeLock(); | 371 virtual bool ShouldCreateResizeLock(); |
| 372 virtual scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock); | 372 virtual scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock); |
| 373 | 373 |
| 374 // Exposed for tests. | 374 // Exposed for tests. |
| 375 aura::Window* window() { return window_; } | 375 aura::Window* window() { return window_; } |
| 376 gfx::Size current_frame_size() const { return current_frame_size_; } | 376 gfx::Size current_frame_size_in_dip() const { |
| 377 return current_frame_size_in_dip_; |
| 378 } |
| 377 void LockResources(); | 379 void LockResources(); |
| 378 void UnlockResources(); | 380 void UnlockResources(); |
| 379 | 381 |
| 380 // Overridden from ui::CompositorObserver: | 382 // Overridden from ui::CompositorObserver: |
| 381 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE; | 383 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE; |
| 382 virtual void OnCompositingStarted(ui::Compositor* compositor, | 384 virtual void OnCompositingStarted(ui::Compositor* compositor, |
| 383 base::TimeTicks start_time) OVERRIDE; | 385 base::TimeTicks start_time) OVERRIDE; |
| 384 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; | 386 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE; |
| 385 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE; | 387 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE; |
| 386 virtual void OnCompositingLockStateChanged( | 388 virtual void OnCompositingLockStateChanged( |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 | 516 |
| 515 // Dismisses a Web Popup on mouse press outside the popup and its parent. | 517 // Dismisses a Web Popup on mouse press outside the popup and its parent. |
| 516 void ApplyEventFilterForPopupExit(ui::MouseEvent* event); | 518 void ApplyEventFilterForPopupExit(ui::MouseEvent* event); |
| 517 | 519 |
| 518 // Converts |rect| from window coordinate to screen coordinate. | 520 // Converts |rect| from window coordinate to screen coordinate. |
| 519 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const; | 521 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const; |
| 520 | 522 |
| 521 // Converts |rect| from screen coordinate to window coordinate. | 523 // Converts |rect| from screen coordinate to window coordinate. |
| 522 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; | 524 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; |
| 523 | 525 |
| 524 typedef base::Callback<void(bool, const scoped_refptr<ui::Texture>&)> | |
| 525 BufferPresentedCallback; | |
| 526 | |
| 527 // The common entry point for buffer updates from renderer | |
| 528 // and GPU process. | |
| 529 void BuffersSwapped(const gfx::Size& surface_size, | |
| 530 const gfx::Rect& damage_rect, | |
| 531 float surface_scale_factor, | |
| 532 const std::string& mailbox_name, | |
| 533 const std::vector<ui::LatencyInfo>& latency_info, | |
| 534 const BufferPresentedCallback& ack_callback); | |
| 535 | |
| 536 bool SwapBuffersPrepare(const gfx::Rect& surface_rect, | |
| 537 float surface_scale_factor, | |
| 538 const gfx::Rect& damage_rect, | |
| 539 const std::string& mailbox_name, | |
| 540 const BufferPresentedCallback& ack_callback); | |
| 541 | |
| 542 void SwapBuffersCompleted( | |
| 543 const BufferPresentedCallback& ack_callback, | |
| 544 const scoped_refptr<ui::Texture>& texture_to_return); | |
| 545 | |
| 546 void SwapDelegatedFrame( | 526 void SwapDelegatedFrame( |
| 547 uint32 output_surface_id, | 527 uint32 output_surface_id, |
| 548 scoped_ptr<cc::DelegatedFrameData> frame_data, | 528 scoped_ptr<cc::DelegatedFrameData> frame_data, |
| 549 float frame_device_scale_factor, | 529 float frame_device_scale_factor, |
| 550 const std::vector<ui::LatencyInfo>& latency_info); | 530 const std::vector<ui::LatencyInfo>& latency_info); |
| 551 void SendDelegatedFrameAck(uint32 output_surface_id); | 531 void SendDelegatedFrameAck(uint32 output_surface_id); |
| 552 void SendReturnedDelegatedResources(uint32 output_surface_id); | 532 void SendReturnedDelegatedResources(uint32 output_surface_id); |
| 553 | 533 |
| 554 // DelegatedFrameEvictorClient implementation. | 534 // DelegatedFrameEvictorClient implementation. |
| 555 virtual void EvictDelegatedFrame() OVERRIDE; | 535 virtual void EvictDelegatedFrame() OVERRIDE; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 bool has_composition_text_; | 613 bool has_composition_text_; |
| 634 | 614 |
| 635 // Whether return characters should be passed on to the RenderWidgetHostImpl. | 615 // Whether return characters should be passed on to the RenderWidgetHostImpl. |
| 636 bool accept_return_character_; | 616 bool accept_return_character_; |
| 637 | 617 |
| 638 // Current tooltip text. | 618 // Current tooltip text. |
| 639 base::string16 tooltip_; | 619 base::string16 tooltip_; |
| 640 | 620 |
| 641 std::vector<base::Closure> on_compositing_did_commit_callbacks_; | 621 std::vector<base::Closure> on_compositing_did_commit_callbacks_; |
| 642 | 622 |
| 643 // The current frontbuffer texture. | |
| 644 scoped_refptr<ui::Texture> current_surface_; | |
| 645 | |
| 646 // This holds the current software framebuffer, if any. | 623 // This holds the current software framebuffer, if any. |
| 647 scoped_ptr<SoftwareFrameManager> software_frame_manager_; | 624 scoped_ptr<SoftwareFrameManager> software_frame_manager_; |
| 648 | 625 |
| 649 // With delegated renderer, this is the last output surface, used to | 626 // With delegated renderer, this is the last output surface, used to |
| 650 // disambiguate resources with the same id coming from different output | 627 // disambiguate resources with the same id coming from different output |
| 651 // surfaces. | 628 // surfaces. |
| 652 uint32 last_output_surface_id_; | 629 uint32 last_output_surface_id_; |
| 653 | 630 |
| 654 // The number of delegated frame acks that are pending, to delay resource | 631 // The number of delegated frame acks that are pending, to delay resource |
| 655 // returns until the acks are sent. | 632 // returns until the acks are sent. |
| 656 int pending_delegated_ack_count_; | 633 int pending_delegated_ack_count_; |
| 657 | 634 |
| 658 // The damage in the previously presented buffer. | |
| 659 SkRegion previous_damage_; | |
| 660 | |
| 661 // Pending damage from previous frames that we skipped. | |
| 662 SkRegion skipped_damage_; | |
| 663 | |
| 664 // True after a delegated frame has been skipped, until a frame is not | 635 // True after a delegated frame has been skipped, until a frame is not |
| 665 // skipped. | 636 // skipped. |
| 666 bool skipped_frames_; | 637 bool skipped_frames_; |
| 667 | 638 |
| 668 // Holds delegated resources that have been given to a DelegatedFrameProvider, | 639 // Holds delegated resources that have been given to a DelegatedFrameProvider, |
| 669 // and gives back resources when they are no longer in use for return to the | 640 // and gives back resources when they are no longer in use for return to the |
| 670 // renderer. | 641 // renderer. |
| 671 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; | 642 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
| 672 | 643 |
| 673 // Provides delegated frame updates to the cc::DelegatedRendererLayer. | 644 // Provides delegated frame updates to the cc::DelegatedRendererLayer. |
| 674 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; | 645 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
| 675 | 646 |
| 676 // The size of the last frame that was swapped (even if we skipped it). | 647 // The size and scale of the last software compositing frame that was swapped. |
| 677 // Used to determine when the skipped_damage_ needs to be reset due to | 648 gfx::Size last_swapped_software_frame_size_; |
| 678 // size changes between front- and backbuffer. | 649 float last_swapped_software_frame_scale_factor_; |
| 679 gfx::Size last_swapped_surface_size_; | |
| 680 float last_swapped_surface_scale_factor_; | |
| 681 | 650 |
| 682 gfx::GLSurfaceHandle shared_surface_handle_; | 651 gfx::GLSurfaceHandle shared_surface_handle_; |
| 683 | 652 |
| 684 // If non-NULL we're in OnPaint() and this is the supplied canvas. | 653 // If non-NULL we're in OnPaint() and this is the supplied canvas. |
| 685 gfx::Canvas* paint_canvas_; | 654 gfx::Canvas* paint_canvas_; |
| 686 | 655 |
| 687 // Used to record the last position of the mouse. | 656 // Used to record the last position of the mouse. |
| 688 // While the mouse is locked, they store the last known position just as mouse | 657 // While the mouse is locked, they store the last known position just as mouse |
| 689 // lock was entered. | 658 // lock was entered. |
| 690 // Relative to the upper-left corner of the view. | 659 // Relative to the upper-left corner of the view. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 706 | 675 |
| 707 // This lock is the one waiting for a frame of the right size to come back | 676 // This lock is the one waiting for a frame of the right size to come back |
| 708 // from the renderer/GPU process. It is set from the moment the aura window | 677 // from the renderer/GPU process. It is set from the moment the aura window |
| 709 // got resized, to the moment we committed the renderer frame of the same | 678 // got resized, to the moment we committed the renderer frame of the same |
| 710 // size. It keeps track of the size we expect from the renderer, and locks the | 679 // size. It keeps track of the size we expect from the renderer, and locks the |
| 711 // compositor, as well as the UI for a short time to give a chance to the | 680 // compositor, as well as the UI for a short time to give a chance to the |
| 712 // renderer of producing a frame of the right size. | 681 // renderer of producing a frame of the right size. |
| 713 scoped_ptr<ResizeLock> resize_lock_; | 682 scoped_ptr<ResizeLock> resize_lock_; |
| 714 | 683 |
| 715 // Keeps track of the current frame size. | 684 // Keeps track of the current frame size. |
| 716 gfx::Size current_frame_size_; | 685 gfx::Size current_frame_size_in_dip_; |
| 717 | 686 |
| 718 // This lock is for waiting for a front surface to become available to draw. | 687 // This lock is for waiting for a front surface to become available to draw. |
| 719 scoped_refptr<ui::CompositorLock> released_front_lock_; | 688 scoped_refptr<ui::CompositorLock> released_front_lock_; |
| 720 | 689 |
| 721 // Used to track the state of the window we're created from. Only used when | 690 // Used to track the state of the window we're created from. Only used when |
| 722 // created fullscreen. | 691 // created fullscreen. |
| 723 scoped_ptr<aura::WindowTracker> host_tracker_; | 692 scoped_ptr<aura::WindowTracker> host_tracker_; |
| 724 | 693 |
| 725 enum CanLockCompositorState { | 694 enum CanLockCompositorState { |
| 726 YES, | 695 YES, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 // passed to windowless plugins like Flash/Silverlight, etc as the | 761 // passed to windowless plugins like Flash/Silverlight, etc as the |
| 793 // container window. | 762 // container window. |
| 794 HWND plugin_parent_window_; | 763 HWND plugin_parent_window_; |
| 795 #endif | 764 #endif |
| 796 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 765 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
| 797 }; | 766 }; |
| 798 | 767 |
| 799 } // namespace content | 768 } // namespace content |
| 800 | 769 |
| 801 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 770 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| OLD | NEW |