| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 // the next drawRect. Return true if the Ack should be sent, false if it | 331 // the next drawRect. Return true if the Ack should be sent, false if it |
| 332 // should be deferred until drawRect. | 332 // should be deferred until drawRect. |
| 333 bool CompositorSwapBuffers(uint64 surface_handle, | 333 bool CompositorSwapBuffers(uint64 surface_handle, |
| 334 const gfx::Size& size, | 334 const gfx::Size& size, |
| 335 float scale_factor, | 335 float scale_factor, |
| 336 const ui::LatencyInfo& latency_info); | 336 const ui::LatencyInfo& latency_info); |
| 337 // Ack pending SwapBuffers requests, if any, to unblock the GPU process. Has | 337 // Ack pending SwapBuffers requests, if any, to unblock the GPU process. Has |
| 338 // no effect if there are no pending requests. | 338 // no effect if there are no pending requests. |
| 339 void AckPendingSwapBuffers(); | 339 void AckPendingSwapBuffers(); |
| 340 | 340 |
| 341 // Ack pending SwapBuffers requests, but no more frequently than the vsync |
| 342 // rate if the renderer is not throttling the swap rate. |
| 343 void ThrottledAckPendingSwapBuffers(); |
| 344 |
| 341 // Returns true and stores first rectangle for character range if the | 345 // Returns true and stores first rectangle for character range if the |
| 342 // requested |range| is already cached, otherwise returns false. | 346 // requested |range| is already cached, otherwise returns false. |
| 343 // Exposed for testing. | 347 // Exposed for testing. |
| 344 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( | 348 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( |
| 345 NSRange range, NSRect* rect, NSRange* actual_range); | 349 NSRange range, NSRect* rect, NSRange* actual_range); |
| 346 | 350 |
| 347 // Returns true if there is line break in |range| and stores line breaking | 351 // Returns true if there is line break in |range| and stores line breaking |
| 348 // point to |line_breaking_point|. The |line_break_point| is valid only if | 352 // point to |line_breaking_point|. The |line_break_point| is valid only if |
| 349 // this function returns true. | 353 // this function returns true. |
| 350 bool GetLineBreakIndex(const std::vector<gfx::Rect>& bounds, | 354 bool GetLineBreakIndex(const std::vector<gfx::Rect>& bounds, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 float scale_factor() const; | 433 float scale_factor() const; |
| 430 | 434 |
| 431 bool is_hidden() const { return is_hidden_; } | 435 bool is_hidden() const { return is_hidden_; } |
| 432 | 436 |
| 433 void FrameSwapped(); | 437 void FrameSwapped(); |
| 434 | 438 |
| 435 private: | 439 private: |
| 436 friend class RenderWidgetHostView; | 440 friend class RenderWidgetHostView; |
| 437 friend class RenderWidgetHostViewMacTest; | 441 friend class RenderWidgetHostViewMacTest; |
| 438 | 442 |
| 443 void GetVSyncParameters( |
| 444 base::TimeTicks* timebase, base::TimeDelta* interval); |
| 445 |
| 439 // The view will associate itself with the given widget. The native view must | 446 // The view will associate itself with the given widget. The native view must |
| 440 // be hooked up immediately to the view hierarchy, or else when it is | 447 // be hooked up immediately to the view hierarchy, or else when it is |
| 441 // deleted it will delete this out from under the caller. | 448 // deleted it will delete this out from under the caller. |
| 442 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); | 449 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); |
| 443 | 450 |
| 444 // Returns whether this render view is a popup (autocomplete window). | 451 // Returns whether this render view is a popup (autocomplete window). |
| 445 bool IsPopup() const; | 452 bool IsPopup() const; |
| 446 | 453 |
| 447 // Shuts down the render_widget_host_. This is a separate function so we can | 454 // Shuts down the render_widget_host_. This is a separate function so we can |
| 448 // invoke it from the message loop. | 455 // invoke it from the message loop. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 // The fullscreen window used for pepper flash. | 507 // The fullscreen window used for pepper flash. |
| 501 scoped_nsobject<NSWindow> pepper_fullscreen_window_; | 508 scoped_nsobject<NSWindow> pepper_fullscreen_window_; |
| 502 scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; | 509 scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; |
| 503 // Our parent host view, if this is fullscreen. NULL otherwise. | 510 // Our parent host view, if this is fullscreen. NULL otherwise. |
| 504 RenderWidgetHostViewMac* fullscreen_parent_host_view_; | 511 RenderWidgetHostViewMac* fullscreen_parent_host_view_; |
| 505 | 512 |
| 506 // List of pending swaps for deferred acking: | 513 // List of pending swaps for deferred acking: |
| 507 // pairs of (route_id, gpu_host_id). | 514 // pairs of (route_id, gpu_host_id). |
| 508 std::list<std::pair<int32, int32> > pending_swap_buffers_acks_; | 515 std::list<std::pair<int32, int32> > pending_swap_buffers_acks_; |
| 509 | 516 |
| 517 // Factory used to cancel outstanding throttled AckPendingSwapBuffers calls. |
| 518 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 519 pending_swap_buffers_acks_weak_factory_; |
| 520 |
| 521 // The earliest time at which the next swap ack may be sent. Only relevant |
| 522 // when swaps are not being throttled by the renderer (when threaded |
| 523 // compositing is off). |
| 524 base::Time next_swap_ack_time_; |
| 525 |
| 510 // The current composition character range and its bounds. | 526 // The current composition character range and its bounds. |
| 511 ui::Range composition_range_; | 527 ui::Range composition_range_; |
| 512 std::vector<gfx::Rect> composition_bounds_; | 528 std::vector<gfx::Rect> composition_bounds_; |
| 513 | 529 |
| 514 // The current caret bounds. | 530 // The current caret bounds. |
| 515 gfx::Rect caret_rect_; | 531 gfx::Rect caret_rect_; |
| 516 | 532 |
| 517 // Subscriber that listens to frame presentation events. | 533 // Subscriber that listens to frame presentation events. |
| 518 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; | 534 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
| 519 | 535 |
| 520 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 536 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 521 }; | 537 }; |
| 522 | 538 |
| 523 } // namespace content | 539 } // namespace content |
| 524 | 540 |
| 525 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 541 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |