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