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