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_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <IOSurface/IOSurfaceAPI.h> | 9 #include <IOSurface/IOSurfaceAPI.h> |
10 #include <list> | 10 #include <list> |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 scoped_refptr<CompositingIOSurfaceMac> compositing_iosurface_; | 435 scoped_refptr<CompositingIOSurfaceMac> compositing_iosurface_; |
436 scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_; | 436 scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_; |
437 | 437 |
438 // Delegated frame management and compositior. | 438 // Delegated frame management and compositior. |
439 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; | 439 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; |
440 scoped_ptr<ui::Layer> root_layer_; | 440 scoped_ptr<ui::Layer> root_layer_; |
441 | 441 |
442 // Container for the NSView drawn by the browser compositor. | 442 // Container for the NSView drawn by the browser compositor. |
443 scoped_ptr<BrowserCompositorViewMac> browser_compositor_view_; | 443 scoped_ptr<BrowserCompositorViewMac> browser_compositor_view_; |
444 | 444 |
| 445 // Set when the browser compositor is requested to paint, and unset when the |
| 446 // browser compositor paints in DoBrowserCompositorPendingPaint. |
| 447 bool browser_compositor_has_pending_paint_; |
| 448 |
445 // Placeholder that is allocated while browser_compositor_view_ is NULL, | 449 // Placeholder that is allocated while browser_compositor_view_ is NULL, |
446 // indicating that a BrowserCompositorViewMac may be allocated. This is to | 450 // indicating that a BrowserCompositorViewMac may be allocated. This is to |
447 // help in recycling the internals of BrowserCompositorViewMac. | 451 // help in recycling the internals of BrowserCompositorViewMac. |
448 scoped_ptr<BrowserCompositorViewPlaceholderMac> | 452 scoped_ptr<BrowserCompositorViewPlaceholderMac> |
449 browser_compositor_view_placeholder_; | 453 browser_compositor_view_placeholder_; |
450 | 454 |
451 // This holds the current software compositing framebuffer, if any. | 455 // This holds the current software compositing framebuffer, if any. |
452 scoped_ptr<SoftwareFrameManager> software_frame_manager_; | 456 scoped_ptr<SoftwareFrameManager> software_frame_manager_; |
453 | 457 |
454 // Latency info to send back when the next frame appears on the | 458 // Latency info to send back when the next frame appears on the |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 virtual gfx::Size DesiredFrameSize() OVERRIDE; | 514 virtual gfx::Size DesiredFrameSize() OVERRIDE; |
511 virtual float CurrentDeviceScaleFactor() OVERRIDE; | 515 virtual float CurrentDeviceScaleFactor() OVERRIDE; |
512 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE; | 516 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE; |
513 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; | 517 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; |
514 | 518 |
515 // BrowserCompositorViewMacClient implementation. | 519 // BrowserCompositorViewMacClient implementation. |
516 virtual void BrowserCompositorViewFrameSwapped( | 520 virtual void BrowserCompositorViewFrameSwapped( |
517 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; | 521 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; |
518 virtual NSView* BrowserCompositorSuperview() OVERRIDE; | 522 virtual NSView* BrowserCompositorSuperview() OVERRIDE; |
519 virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; | 523 virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; |
| 524 virtual bool BrowserCompositorShouldDrawImmediately() OVERRIDE; |
520 | 525 |
521 private: | 526 private: |
522 friend class RenderWidgetHostViewMacTest; | 527 friend class RenderWidgetHostViewMacTest; |
523 | 528 |
524 struct PendingSwapAck { | 529 struct PendingSwapAck { |
525 PendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id) | 530 PendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id) |
526 : route_id(route_id), | 531 : route_id(route_id), |
527 gpu_host_id(gpu_host_id), | 532 gpu_host_id(gpu_host_id), |
528 renderer_id(renderer_id) {} | 533 renderer_id(renderer_id) {} |
529 int32 route_id; | 534 int32 route_id; |
530 int gpu_host_id; | 535 int gpu_host_id; |
531 int32 renderer_id; | 536 int32 renderer_id; |
532 }; | 537 }; |
533 scoped_ptr<PendingSwapAck> pending_swap_ack_; | 538 scoped_ptr<PendingSwapAck> pending_swap_ack_; |
534 void AddPendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id); | 539 void AddPendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id); |
535 | 540 |
536 // Returns whether this render view is a popup (autocomplete window). | 541 // Returns whether this render view is a popup (autocomplete window). |
537 bool IsPopup() const; | 542 bool IsPopup() const; |
538 | 543 |
539 // Shuts down the render_widget_host_. This is a separate function so we can | 544 // Shuts down the render_widget_host_. This is a separate function so we can |
540 // invoke it from the message loop. | 545 // invoke it from the message loop. |
541 void ShutdownHost(); | 546 void ShutdownHost(); |
542 | 547 |
543 void EnsureBrowserCompositorView(); | 548 void EnsureBrowserCompositorView(); |
544 void DestroyBrowserCompositorView(); | 549 void DestroyBrowserCompositorView(); |
| 550 void DoBrowserCompositorPendingPaint(); |
545 | 551 |
546 void EnsureSoftwareLayer(); | 552 void EnsureSoftwareLayer(); |
547 void DestroySoftwareLayer(); | 553 void DestroySoftwareLayer(); |
548 | 554 |
549 bool EnsureCompositedIOSurface() WARN_UNUSED_RESULT; | 555 bool EnsureCompositedIOSurface() WARN_UNUSED_RESULT; |
550 void EnsureCompositedIOSurfaceLayer(); | 556 void EnsureCompositedIOSurfaceLayer(); |
551 enum DestroyCompositedIOSurfaceLayerBehavior { | 557 enum DestroyCompositedIOSurfaceLayerBehavior { |
552 kLeaveLayerInHierarchy, | 558 kLeaveLayerInHierarchy, |
553 kRemoveLayerFromHierarchy, | 559 kRemoveLayerFromHierarchy, |
554 }; | 560 }; |
(...skipping 21 matching lines...) Expand all Loading... |
576 void SendVSyncParametersToRenderer(); | 582 void SendVSyncParametersToRenderer(); |
577 | 583 |
578 // The associated view. This is weak and is inserted into the view hierarchy | 584 // The associated view. This is weak and is inserted into the view hierarchy |
579 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 585 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
580 // destructor. | 586 // destructor. |
581 RenderWidgetHostViewCocoa* cocoa_view_; | 587 RenderWidgetHostViewCocoa* cocoa_view_; |
582 | 588 |
583 // Indicates if the page is loading. | 589 // Indicates if the page is loading. |
584 bool is_loading_; | 590 bool is_loading_; |
585 | 591 |
| 592 // Indicates if the view is currently stalled waiting for a new frame to come |
| 593 // in. |
| 594 bool is_paused_for_resize_or_repaint_; |
| 595 |
586 // The text to be shown in the tooltip, supplied by the renderer. | 596 // The text to be shown in the tooltip, supplied by the renderer. |
587 base::string16 tooltip_text_; | 597 base::string16 tooltip_text_; |
588 | 598 |
589 // Factory used to safely scope delayed calls to ShutdownHost(). | 599 // Factory used to safely scope delayed calls to ShutdownHost(). |
590 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 600 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
591 | 601 |
592 // selected text on the renderer. | 602 // selected text on the renderer. |
593 std::string selected_text_; | 603 std::string selected_text_; |
594 | 604 |
595 // The window used for popup widgets. | 605 // The window used for popup widgets. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; | 639 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
630 | 640 |
631 base::WeakPtrFactory<RenderWidgetHostViewMac> | 641 base::WeakPtrFactory<RenderWidgetHostViewMac> |
632 software_frame_weak_ptr_factory_; | 642 software_frame_weak_ptr_factory_; |
633 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 643 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
634 }; | 644 }; |
635 | 645 |
636 } // namespace content | 646 } // namespace content |
637 | 647 |
638 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 648 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |