| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 virtual gfx::Size DesiredFrameSize() OVERRIDE; | 522 virtual gfx::Size DesiredFrameSize() OVERRIDE; |
| 519 virtual float CurrentDeviceScaleFactor() OVERRIDE; | 523 virtual float CurrentDeviceScaleFactor() OVERRIDE; |
| 520 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE; | 524 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE; |
| 521 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; | 525 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; |
| 522 | 526 |
| 523 // BrowserCompositorViewMacClient implementation. | 527 // BrowserCompositorViewMacClient implementation. |
| 524 virtual void BrowserCompositorViewFrameSwapped( | 528 virtual void BrowserCompositorViewFrameSwapped( |
| 525 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; | 529 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; |
| 526 virtual NSView* BrowserCompositorSuperview() OVERRIDE; | 530 virtual NSView* BrowserCompositorSuperview() OVERRIDE; |
| 527 virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; | 531 virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; |
| 532 virtual bool BrowserCompositorShouldDrawImmediately() OVERRIDE; |
| 528 | 533 |
| 529 private: | 534 private: |
| 530 friend class RenderWidgetHostViewMacTest; | 535 friend class RenderWidgetHostViewMacTest; |
| 531 | 536 |
| 532 struct PendingSwapAck { | 537 struct PendingSwapAck { |
| 533 PendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id) | 538 PendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id) |
| 534 : route_id(route_id), | 539 : route_id(route_id), |
| 535 gpu_host_id(gpu_host_id), | 540 gpu_host_id(gpu_host_id), |
| 536 renderer_id(renderer_id) {} | 541 renderer_id(renderer_id) {} |
| 537 int32 route_id; | 542 int32 route_id; |
| 538 int gpu_host_id; | 543 int gpu_host_id; |
| 539 int32 renderer_id; | 544 int32 renderer_id; |
| 540 }; | 545 }; |
| 541 scoped_ptr<PendingSwapAck> pending_swap_ack_; | 546 scoped_ptr<PendingSwapAck> pending_swap_ack_; |
| 542 void AddPendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id); | 547 void AddPendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id); |
| 543 | 548 |
| 544 // Returns whether this render view is a popup (autocomplete window). | 549 // Returns whether this render view is a popup (autocomplete window). |
| 545 bool IsPopup() const; | 550 bool IsPopup() const; |
| 546 | 551 |
| 547 // Shuts down the render_widget_host_. This is a separate function so we can | 552 // Shuts down the render_widget_host_. This is a separate function so we can |
| 548 // invoke it from the message loop. | 553 // invoke it from the message loop. |
| 549 void ShutdownHost(); | 554 void ShutdownHost(); |
| 550 | 555 |
| 551 void EnsureBrowserCompositorView(); | 556 void EnsureBrowserCompositorView(); |
| 552 void DestroyBrowserCompositorView(); | 557 void DestroyBrowserCompositorView(); |
| 558 void DoBrowserCompositorPendingPaint(); |
| 553 | 559 |
| 554 void EnsureSoftwareLayer(); | 560 void EnsureSoftwareLayer(); |
| 555 void DestroySoftwareLayer(); | 561 void DestroySoftwareLayer(); |
| 556 | 562 |
| 557 bool EnsureCompositedIOSurface() WARN_UNUSED_RESULT; | 563 bool EnsureCompositedIOSurface() WARN_UNUSED_RESULT; |
| 558 void EnsureCompositedIOSurfaceLayer(); | 564 void EnsureCompositedIOSurfaceLayer(); |
| 559 enum DestroyCompositedIOSurfaceLayerBehavior { | 565 enum DestroyCompositedIOSurfaceLayerBehavior { |
| 560 kLeaveLayerInHierarchy, | 566 kLeaveLayerInHierarchy, |
| 561 kRemoveLayerFromHierarchy, | 567 kRemoveLayerFromHierarchy, |
| 562 }; | 568 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 584 void SendVSyncParametersToRenderer(); | 590 void SendVSyncParametersToRenderer(); |
| 585 | 591 |
| 586 // The associated view. This is weak and is inserted into the view hierarchy | 592 // The associated view. This is weak and is inserted into the view hierarchy |
| 587 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 593 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
| 588 // destructor. | 594 // destructor. |
| 589 RenderWidgetHostViewCocoa* cocoa_view_; | 595 RenderWidgetHostViewCocoa* cocoa_view_; |
| 590 | 596 |
| 591 // Indicates if the page is loading. | 597 // Indicates if the page is loading. |
| 592 bool is_loading_; | 598 bool is_loading_; |
| 593 | 599 |
| 600 // Indicates if the view is currently stalled waiting for a new frame to come |
| 601 // in. |
| 602 bool is_paused_for_resize_or_repaint_; |
| 603 |
| 594 // The text to be shown in the tooltip, supplied by the renderer. | 604 // The text to be shown in the tooltip, supplied by the renderer. |
| 595 base::string16 tooltip_text_; | 605 base::string16 tooltip_text_; |
| 596 | 606 |
| 597 // Factory used to safely scope delayed calls to ShutdownHost(). | 607 // Factory used to safely scope delayed calls to ShutdownHost(). |
| 598 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 608 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
| 599 | 609 |
| 600 // selected text on the renderer. | 610 // selected text on the renderer. |
| 601 std::string selected_text_; | 611 std::string selected_text_; |
| 602 | 612 |
| 603 // The window used for popup widgets. | 613 // The window used for popup widgets. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; | 647 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
| 638 | 648 |
| 639 base::WeakPtrFactory<RenderWidgetHostViewMac> | 649 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 640 software_frame_weak_ptr_factory_; | 650 software_frame_weak_ptr_factory_; |
| 641 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 651 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 642 }; | 652 }; |
| 643 | 653 |
| 644 } // namespace content | 654 } // namespace content |
| 645 | 655 |
| 646 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 656 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |