| 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 <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 virtual void AcceleratedSurfaceBuffersSwapped( | 299 virtual void AcceleratedSurfaceBuffersSwapped( |
| 300 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 300 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 301 int gpu_host_id) OVERRIDE; | 301 int gpu_host_id) OVERRIDE; |
| 302 virtual void AcceleratedSurfacePostSubBuffer( | 302 virtual void AcceleratedSurfacePostSubBuffer( |
| 303 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 303 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 304 int gpu_host_id) OVERRIDE; | 304 int gpu_host_id) OVERRIDE; |
| 305 virtual void AcceleratedSurfaceSuspend() OVERRIDE; | 305 virtual void AcceleratedSurfaceSuspend() OVERRIDE; |
| 306 virtual void AcceleratedSurfaceRelease() OVERRIDE; | 306 virtual void AcceleratedSurfaceRelease() OVERRIDE; |
| 307 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; | 307 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; |
| 308 virtual void AboutToWaitForBackingStoreMsg() OVERRIDE; | |
| 309 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; | 308 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; |
| 310 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; | 309 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; |
| 311 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; | 310 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; |
| 312 | 311 |
| 313 virtual void SetHasHorizontalScrollbar( | 312 virtual void SetHasHorizontalScrollbar( |
| 314 bool has_horizontal_scrollbar) OVERRIDE; | 313 bool has_horizontal_scrollbar) OVERRIDE; |
| 315 virtual void SetScrollOffsetPinning( | 314 virtual void SetScrollOffsetPinning( |
| 316 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 315 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; |
| 317 virtual bool LockMouse() OVERRIDE; | 316 virtual bool LockMouse() OVERRIDE; |
| 318 virtual void UnlockMouse() OVERRIDE; | 317 virtual void UnlockMouse() OVERRIDE; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 int window_number() const; | 463 int window_number() const; |
| 465 | 464 |
| 466 float scale_factor() const; | 465 float scale_factor() const; |
| 467 | 466 |
| 468 void FrameSwapped(); | 467 void FrameSwapped(); |
| 469 | 468 |
| 470 private: | 469 private: |
| 471 friend class RenderWidgetHostView; | 470 friend class RenderWidgetHostView; |
| 472 friend class RenderWidgetHostViewMacTest; | 471 friend class RenderWidgetHostViewMacTest; |
| 473 | 472 |
| 474 void GetVSyncParameters( | |
| 475 base::TimeTicks* timebase, base::TimeDelta* interval); | |
| 476 | |
| 477 // The view will associate itself with the given widget. The native view must | 473 // The view will associate itself with the given widget. The native view must |
| 478 // be hooked up immediately to the view hierarchy, or else when it is | 474 // be hooked up immediately to the view hierarchy, or else when it is |
| 479 // deleted it will delete this out from under the caller. | 475 // deleted it will delete this out from under the caller. |
| 480 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); | 476 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); |
| 481 | 477 |
| 482 // Returns whether this render view is a popup (autocomplete window). | 478 // Returns whether this render view is a popup (autocomplete window). |
| 483 bool IsPopup() const; | 479 bool IsPopup() const; |
| 484 | 480 |
| 485 // Shuts down the render_widget_host_. This is a separate function so we can | 481 // Shuts down the render_widget_host_. This is a separate function so we can |
| 486 // invoke it from the message loop. | 482 // invoke it from the message loop. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 497 | 493 |
| 498 // Unbind the GL context (if any) that is bound to |cocoa_view_|. | 494 // Unbind the GL context (if any) that is bound to |cocoa_view_|. |
| 499 void ClearBoundContextDrawable(); | 495 void ClearBoundContextDrawable(); |
| 500 | 496 |
| 501 // Called when a GPU SwapBuffers is received. | 497 // Called when a GPU SwapBuffers is received. |
| 502 void GotAcceleratedFrame(); | 498 void GotAcceleratedFrame(); |
| 503 | 499 |
| 504 // Called when a software DIB is received. | 500 // Called when a software DIB is received. |
| 505 void GotSoftwareFrame(); | 501 void GotSoftwareFrame(); |
| 506 | 502 |
| 507 // Ack pending SwapBuffers requests, if any, to unblock the GPU process. Has | |
| 508 // no effect if there are no pending requests. | |
| 509 void AckPendingSwapBuffers(); | |
| 510 | |
| 511 // Ack pending SwapBuffers requests, but no more frequently than the vsync | |
| 512 // rate if the renderer is not throttling the swap rate. | |
| 513 void ThrottledAckPendingSwapBuffers(); | |
| 514 | |
| 515 void OnPluginFocusChanged(bool focused, int plugin_id); | 503 void OnPluginFocusChanged(bool focused, int plugin_id); |
| 516 void OnStartPluginIme(); | 504 void OnStartPluginIme(); |
| 517 CONTENT_EXPORT void OnAcceleratedSurfaceSetIOSurface( | |
| 518 gfx::PluginWindowHandle window, | |
| 519 int32 width, | |
| 520 int32 height, | |
| 521 uint64 mach_port); | |
| 522 void OnAcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window, | |
| 523 int32 width, | |
| 524 int32 height, | |
| 525 TransportDIB::Handle transport_dib); | |
| 526 void OnAcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window, | |
| 527 uint64 surface_handle); | |
| 528 | 505 |
| 529 // Convert |rect| from the views coordinate (upper-left origin) into | 506 // Convert |rect| from the views coordinate (upper-left origin) into |
| 530 // the OpenGL coordinate (lower-left origin) and scale for HiDPI displays. | 507 // the OpenGL coordinate (lower-left origin) and scale for HiDPI displays. |
| 531 gfx::Rect GetScaledOpenGLPixelRect(const gfx::Rect& rect); | 508 gfx::Rect GetScaledOpenGLPixelRect(const gfx::Rect& rect); |
| 532 | 509 |
| 533 // The associated view. This is weak and is inserted into the view hierarchy | 510 // The associated view. This is weak and is inserted into the view hierarchy |
| 534 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 511 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
| 535 // destructor. | 512 // destructor. |
| 536 RenderWidgetHostViewCocoa* cocoa_view_; | 513 RenderWidgetHostViewCocoa* cocoa_view_; |
| 537 | 514 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 549 | 526 |
| 550 // The window used for popup widgets. | 527 // The window used for popup widgets. |
| 551 base::scoped_nsobject<NSWindow> popup_window_; | 528 base::scoped_nsobject<NSWindow> popup_window_; |
| 552 | 529 |
| 553 // The fullscreen window used for pepper flash. | 530 // The fullscreen window used for pepper flash. |
| 554 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; | 531 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; |
| 555 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; | 532 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; |
| 556 // Our parent host view, if this is fullscreen. NULL otherwise. | 533 // Our parent host view, if this is fullscreen. NULL otherwise. |
| 557 RenderWidgetHostViewMac* fullscreen_parent_host_view_; | 534 RenderWidgetHostViewMac* fullscreen_parent_host_view_; |
| 558 | 535 |
| 559 // List of pending swaps for deferred acking: | |
| 560 // pairs of (route_id, gpu_host_id). | |
| 561 std::list<std::pair<int32, int32> > pending_swap_buffers_acks_; | |
| 562 | |
| 563 // Factory used to cancel outstanding throttled AckPendingSwapBuffers calls. | |
| 564 base::WeakPtrFactory<RenderWidgetHostViewMac> | |
| 565 pending_swap_buffers_acks_weak_factory_; | |
| 566 | |
| 567 // The overlay view which is rendered above this one in the same | 536 // The overlay view which is rendered above this one in the same |
| 568 // accelerated IOSurface. | 537 // accelerated IOSurface. |
| 569 // Overlay view has |underlay_view_| set to this view. | 538 // Overlay view has |underlay_view_| set to this view. |
| 570 base::WeakPtr<RenderWidgetHostViewMac> overlay_view_; | 539 base::WeakPtr<RenderWidgetHostViewMac> overlay_view_; |
| 571 | 540 |
| 572 // Offset at which overlay view should be rendered. | 541 // Offset at which overlay view should be rendered. |
| 573 gfx::Point overlay_view_offset_; | 542 gfx::Point overlay_view_offset_; |
| 574 | 543 |
| 575 // The underlay view which this view is rendered above in the same | 544 // The underlay view which this view is rendered above in the same |
| 576 // accelerated IOSurface. | 545 // accelerated IOSurface. |
| 577 // Underlay view has |overlay_view_| set to this view. | 546 // Underlay view has |overlay_view_| set to this view. |
| 578 base::WeakPtr<RenderWidgetHostViewMac> underlay_view_; | 547 base::WeakPtr<RenderWidgetHostViewMac> underlay_view_; |
| 579 | 548 |
| 580 // Set to true when |underlay_view_| has drawn this view. After that point, | 549 // Set to true when |underlay_view_| has drawn this view. After that point, |
| 581 // this view should not draw again until |underlay_view_| is changed. | 550 // this view should not draw again until |underlay_view_| is changed. |
| 582 bool underlay_view_has_drawn_; | 551 bool underlay_view_has_drawn_; |
| 583 | 552 |
| 584 // Factory used to safely reference overlay view set in SetOverlayView. | 553 // Factory used to safely reference overlay view set in SetOverlayView. |
| 585 base::WeakPtrFactory<RenderWidgetHostViewMac> | 554 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 586 overlay_view_weak_factory_; | 555 overlay_view_weak_factory_; |
| 587 | 556 |
| 588 // The earliest time at which the next swap ack may be sent. Only relevant | |
| 589 // when swaps are not being throttled by the renderer (when threaded | |
| 590 // compositing is off). | |
| 591 base::Time next_swap_ack_time_; | |
| 592 | |
| 593 // The current composition character range and its bounds. | 557 // The current composition character range and its bounds. |
| 594 gfx::Range composition_range_; | 558 gfx::Range composition_range_; |
| 595 std::vector<gfx::Rect> composition_bounds_; | 559 std::vector<gfx::Rect> composition_bounds_; |
| 596 | 560 |
| 597 // The current caret bounds. | 561 // The current caret bounds. |
| 598 gfx::Rect caret_rect_; | 562 gfx::Rect caret_rect_; |
| 599 | 563 |
| 600 // Subscriber that listens to frame presentation events. | 564 // Subscriber that listens to frame presentation events. |
| 601 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; | 565 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
| 602 | 566 |
| 603 base::WeakPtrFactory<RenderWidgetHostViewMac> | 567 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 604 software_frame_weak_ptr_factory_; | 568 software_frame_weak_ptr_factory_; |
| 605 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 569 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 606 }; | 570 }; |
| 607 | 571 |
| 608 } // namespace content | 572 } // namespace content |
| 609 | 573 |
| 610 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 574 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |