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 19 matching lines...) Expand all Loading... |
30 #include "ipc/ipc_sender.h" | 30 #include "ipc/ipc_sender.h" |
31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
32 #include "ui/base/cocoa/base_view.h" | 32 #include "ui/base/cocoa/base_view.h" |
33 #include "ui/base/cocoa/remote_layer_api.h" | 33 #include "ui/base/cocoa/remote_layer_api.h" |
34 #include "ui/gfx/display_observer.h" | 34 #include "ui/gfx/display_observer.h" |
35 | 35 |
36 struct ViewHostMsg_TextInputState_Params; | 36 struct ViewHostMsg_TextInputState_Params; |
37 | 37 |
38 namespace content { | 38 namespace content { |
39 class BrowserCompositorviewMac; | 39 class BrowserCompositorviewMac; |
| 40 class CompositingIOSurfaceMac; |
| 41 class CompositingIOSurfaceContext; |
40 class RenderWidgetHostViewMac; | 42 class RenderWidgetHostViewMac; |
41 class RenderWidgetHostViewMacEditCommandHelper; | 43 class RenderWidgetHostViewMacEditCommandHelper; |
42 class WebContents; | 44 class WebContents; |
43 } | 45 } |
44 | 46 |
45 namespace ui { | 47 namespace ui { |
46 class Compositor; | 48 class Compositor; |
47 class Layer; | 49 class Layer; |
48 } | 50 } |
49 | 51 |
| 52 @class CompositingIOSurfaceLayer; |
50 @class FullscreenWindowManager; | 53 @class FullscreenWindowManager; |
51 @protocol RenderWidgetHostViewMacDelegate; | 54 @protocol RenderWidgetHostViewMacDelegate; |
| 55 @class SoftwareLayer; |
52 @class ToolTip; | 56 @class ToolTip; |
53 | 57 |
54 @protocol RenderWidgetHostViewMacOwner | 58 @protocol RenderWidgetHostViewMacOwner |
55 - (content::RenderWidgetHostViewMac*)renderWidgetHostViewMac; | 59 - (content::RenderWidgetHostViewMac*)renderWidgetHostViewMac; |
56 @end | 60 @end |
57 | 61 |
58 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, | 62 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, |
59 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles | 63 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles |
60 // but that means that the view needs to own the delegate and will dispose of it | 64 // but that means that the view needs to own the delegate and will dispose of it |
61 // when it's removed from the view system. | 65 // when it's removed from the view system. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 148 |
145 // Whether or not plugin IME is currently enabled active. | 149 // Whether or not plugin IME is currently enabled active. |
146 BOOL pluginImeActive_; | 150 BOOL pluginImeActive_; |
147 | 151 |
148 // Whether the previous mouse event was ignored due to hitTest check. | 152 // Whether the previous mouse event was ignored due to hitTest check. |
149 BOOL mouseEventWasIgnored_; | 153 BOOL mouseEventWasIgnored_; |
150 | 154 |
151 // Event monitor for scroll wheel end event. | 155 // Event monitor for scroll wheel end event. |
152 id endWheelMonitor_; | 156 id endWheelMonitor_; |
153 | 157 |
| 158 // OpenGL Support: |
| 159 |
| 160 // recursive globalFrameDidChange protection: |
| 161 BOOL handlingGlobalFrameDidChange_; |
| 162 |
| 163 // The scale factor of the display this view is in. |
| 164 float deviceScaleFactor_; |
| 165 |
154 // If true then escape key down events are suppressed until the first escape | 166 // If true then escape key down events are suppressed until the first escape |
155 // key up event. (The up event is suppressed as well). This is used by the | 167 // key up event. (The up event is suppressed as well). This is used by the |
156 // flash fullscreen code to avoid sending a key up event without a matching | 168 // flash fullscreen code to avoid sending a key up event without a matching |
157 // key down event. | 169 // key down event. |
158 BOOL suppressNextEscapeKeyUp_; | 170 BOOL suppressNextEscapeKeyUp_; |
159 } | 171 } |
160 | 172 |
161 @property(nonatomic, readonly) NSRange selectedRange; | 173 @property(nonatomic, readonly) NSRange selectedRange; |
162 @property(nonatomic, readonly) BOOL suppressNextEscapeKeyUp; | 174 @property(nonatomic, readonly) BOOL suppressNextEscapeKeyUp; |
163 | 175 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // "The lifetime of the RenderWidgetHost* is tied to the render process. | 212 // "The lifetime of the RenderWidgetHost* is tied to the render process. |
201 // If the render process dies, the RenderWidgetHost* goes away and all | 213 // If the render process dies, the RenderWidgetHost* goes away and all |
202 // references to it must become NULL." | 214 // references to it must become NULL." |
203 // | 215 // |
204 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 216 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
205 class CONTENT_EXPORT RenderWidgetHostViewMac | 217 class CONTENT_EXPORT RenderWidgetHostViewMac |
206 : public RenderWidgetHostViewBase, | 218 : public RenderWidgetHostViewBase, |
207 public DelegatedFrameHostClient, | 219 public DelegatedFrameHostClient, |
208 public BrowserCompositorViewMacClient, | 220 public BrowserCompositorViewMacClient, |
209 public IPC::Sender, | 221 public IPC::Sender, |
| 222 public SoftwareFrameManagerClient, |
210 public CompositingIOSurfaceLayerClient, | 223 public CompositingIOSurfaceLayerClient, |
211 public gfx::DisplayObserver { | 224 public gfx::DisplayObserver { |
212 public: | 225 public: |
213 // The view will associate itself with the given widget. The native view must | 226 // The view will associate itself with the given widget. The native view must |
214 // be hooked up immediately to the view hierarchy, or else when it is | 227 // be hooked up immediately to the view hierarchy, or else when it is |
215 // deleted it will delete this out from under the caller. | 228 // deleted it will delete this out from under the caller. |
216 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); | 229 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); |
217 virtual ~RenderWidgetHostViewMac(); | 230 virtual ~RenderWidgetHostViewMac(); |
218 | 231 |
219 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } | 232 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; | 334 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; |
322 | 335 |
323 virtual bool LockMouse() OVERRIDE; | 336 virtual bool LockMouse() OVERRIDE; |
324 virtual void UnlockMouse() OVERRIDE; | 337 virtual void UnlockMouse() OVERRIDE; |
325 virtual void WheelEventAck(const blink::WebMouseWheelEvent& event, | 338 virtual void WheelEventAck(const blink::WebMouseWheelEvent& event, |
326 InputEventAckState ack_result) OVERRIDE; | 339 InputEventAckState ack_result) OVERRIDE; |
327 | 340 |
328 // IPC::Sender implementation. | 341 // IPC::Sender implementation. |
329 virtual bool Send(IPC::Message* message) OVERRIDE; | 342 virtual bool Send(IPC::Message* message) OVERRIDE; |
330 | 343 |
| 344 // SoftwareFrameManagerClient implementation: |
| 345 virtual void SoftwareFrameWasFreed( |
| 346 uint32 output_surface_id, unsigned frame_id) OVERRIDE; |
| 347 virtual void ReleaseReferencesToSoftwareFrame() OVERRIDE; |
| 348 |
331 virtual SkColorType PreferredReadbackFormat() OVERRIDE; | 349 virtual SkColorType PreferredReadbackFormat() OVERRIDE; |
332 | 350 |
333 // CompositingIOSurfaceLayerClient implementation. | 351 // CompositingIOSurfaceLayerClient implementation. |
334 virtual bool AcceleratedLayerShouldAckImmediately() const OVERRIDE; | 352 virtual bool AcceleratedLayerShouldAckImmediately() const OVERRIDE; |
335 virtual void AcceleratedLayerDidDrawFrame() OVERRIDE; | 353 virtual void AcceleratedLayerDidDrawFrame() OVERRIDE; |
336 virtual void AcceleratedLayerHitError() OVERRIDE; | 354 virtual void AcceleratedLayerHitError() OVERRIDE; |
337 | 355 |
338 // gfx::DisplayObserver implementation. | 356 // gfx::DisplayObserver implementation. |
339 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; | 357 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; |
340 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | 358 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; |
341 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 359 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
342 uint32_t metrics) OVERRIDE; | 360 uint32_t metrics) OVERRIDE; |
343 | 361 |
344 // Forwards the mouse event to the renderer. | 362 // Forwards the mouse event to the renderer. |
345 void ForwardMouseEvent(const blink::WebMouseEvent& event); | 363 void ForwardMouseEvent(const blink::WebMouseEvent& event); |
346 | 364 |
347 void KillSelf(); | 365 void KillSelf(); |
348 | 366 |
349 void SetTextInputActive(bool active); | 367 void SetTextInputActive(bool active); |
350 | 368 |
351 // Sends completed plugin IME notification and text back to the renderer. | 369 // Sends completed plugin IME notification and text back to the renderer. |
352 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); | 370 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); |
353 | 371 |
354 const std::string& selected_text() const { return selected_text_; } | 372 const std::string& selected_text() const { return selected_text_; } |
355 | 373 |
| 374 // Update the IOSurface to be drawn and call setNeedsDisplay on |
| 375 // |cocoa_view_|. |
| 376 void CompositorSwapBuffers(IOSurfaceID surface_handle, |
| 377 const gfx::Rect& damage_rect, |
| 378 const gfx::Size& surface_size, |
| 379 float scale_factor, |
| 380 const std::vector<ui::LatencyInfo>& latency_info); |
| 381 |
| 382 // Called when a GPU error is detected. Posts a task to destroy all |
| 383 // compositing state. |
| 384 void GotAcceleratedCompositingError(); |
| 385 |
356 // Returns true and stores first rectangle for character range if the | 386 // Returns true and stores first rectangle for character range if the |
357 // requested |range| is already cached, otherwise returns false. | 387 // requested |range| is already cached, otherwise returns false. |
358 // Exposed for testing. | 388 // Exposed for testing. |
359 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( | 389 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( |
360 NSRange range, NSRect* rect, NSRange* actual_range); | 390 NSRange range, NSRect* rect, NSRange* actual_range); |
361 | 391 |
362 // Returns true if there is line break in |range| and stores line breaking | 392 // Returns true if there is line break in |range| and stores line breaking |
363 // point to |line_breaking_point|. The |line_break_point| is valid only if | 393 // point to |line_breaking_point|. The |line_break_point| is valid only if |
364 // this function returns true. | 394 // this function returns true. |
365 bool GetLineBreakIndex(const std::vector<gfx::Rect>& bounds, | 395 bool GetLineBreakIndex(const std::vector<gfx::Rect>& bounds, |
(...skipping 20 matching lines...) Expand all Loading... |
386 // someone (other than superview) has retained |cocoa_view_|. | 416 // someone (other than superview) has retained |cocoa_view_|. |
387 RenderWidgetHostImpl* render_widget_host_; | 417 RenderWidgetHostImpl* render_widget_host_; |
388 | 418 |
389 // Current text input type. | 419 // Current text input type. |
390 ui::TextInputType text_input_type_; | 420 ui::TextInputType text_input_type_; |
391 bool can_compose_inline_; | 421 bool can_compose_inline_; |
392 | 422 |
393 // The background CoreAnimation layer which is hosted by |cocoa_view_|. | 423 // The background CoreAnimation layer which is hosted by |cocoa_view_|. |
394 base::scoped_nsobject<CALayer> background_layer_; | 424 base::scoped_nsobject<CALayer> background_layer_; |
395 | 425 |
| 426 // A flipped layer, which acts as the parent of the compositing and software |
| 427 // layers. This layer is flipped so that the we don't need to recompute the |
| 428 // origin for sub-layers when their position changes (this is impossible when |
| 429 // using remote layers, as their size change cannot be synchronized with the |
| 430 // window). This indirection is needed because flipping hosted layers (like |
| 431 // |background_layer_|) leads to unpredictable behavior. |
| 432 base::scoped_nsobject<CALayer> flipped_layer_; |
| 433 |
| 434 // The CoreAnimation layer hosted by the GPU process. |
| 435 base::scoped_nsobject<CALayerHost> remote_layer_host_; |
| 436 |
| 437 // The CoreAnimation layer for software compositing. This should be NULL |
| 438 // when software compositing is not in use. |
| 439 base::scoped_nsobject<SoftwareLayer> software_layer_; |
| 440 |
| 441 // Accelerated compositing structures. These may be dynamically created and |
| 442 // destroyed together in Create/DestroyCompositedIOSurfaceAndLayer. |
| 443 base::scoped_nsobject<CompositingIOSurfaceLayer> compositing_iosurface_layer_; |
| 444 scoped_refptr<CompositingIOSurfaceMac> compositing_iosurface_; |
| 445 scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_; |
| 446 |
396 // Delegated frame management and compositior. | 447 // Delegated frame management and compositior. |
397 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; | 448 scoped_ptr<DelegatedFrameHost> delegated_frame_host_; |
398 scoped_ptr<ui::Layer> root_layer_; | 449 scoped_ptr<ui::Layer> root_layer_; |
399 | 450 |
400 // Container for the NSView drawn by the browser compositor. | 451 // Container for the NSView drawn by the browser compositor. |
401 scoped_ptr<BrowserCompositorViewMac> browser_compositor_view_; | 452 scoped_ptr<BrowserCompositorViewMac> browser_compositor_view_; |
402 | 453 |
403 // Placeholder that is allocated while browser_compositor_view_ is NULL, | 454 // Placeholder that is allocated while browser_compositor_view_ is NULL, |
404 // indicating that a BrowserCompositorViewMac may be allocated. This is to | 455 // indicating that a BrowserCompositorViewMac may be allocated. This is to |
405 // help in recycling the internals of BrowserCompositorViewMac. | 456 // help in recycling the internals of BrowserCompositorViewMac. |
406 scoped_ptr<BrowserCompositorViewPlaceholderMac> | 457 scoped_ptr<BrowserCompositorViewPlaceholderMac> |
407 browser_compositor_view_placeholder_; | 458 browser_compositor_view_placeholder_; |
408 | 459 |
| 460 // This holds the current software compositing framebuffer, if any. |
| 461 scoped_ptr<SoftwareFrameManager> software_frame_manager_; |
| 462 |
| 463 // Latency info to send back when the next frame appears on the |
| 464 // screen. |
| 465 std::vector<ui::LatencyInfo> pending_latency_info_; |
| 466 |
409 NSWindow* pepper_fullscreen_window() const { | 467 NSWindow* pepper_fullscreen_window() const { |
410 return pepper_fullscreen_window_; | 468 return pepper_fullscreen_window_; |
411 } | 469 } |
412 | 470 |
413 CONTENT_EXPORT void release_pepper_fullscreen_window_for_testing(); | 471 CONTENT_EXPORT void release_pepper_fullscreen_window_for_testing(); |
414 | 472 |
415 RenderWidgetHostViewMac* fullscreen_parent_host_view() const { | 473 RenderWidgetHostViewMac* fullscreen_parent_host_view() const { |
416 return fullscreen_parent_host_view_; | 474 return fullscreen_parent_host_view_; |
417 } | 475 } |
418 | 476 |
| 477 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { |
| 478 return frame_subscriber_.get(); |
| 479 } |
| 480 |
419 int window_number() const; | 481 int window_number() const; |
420 | 482 |
421 // The scale factor for the screen that the view is currently on. | 483 // The scale factor for the screen that the view is currently on. |
422 float ViewScaleFactor() const; | 484 float ViewScaleFactor() const; |
423 | 485 |
424 // Update the scale factor for the backing store and for any CALayers. | 486 // Update the scale factor for the backing store and for any CALayers. |
425 void UpdateBackingStoreScaleFactor(); | 487 void UpdateBackingStoreScaleFactor(); |
426 | 488 |
427 // Ensure that the display link is associated with the correct display. | 489 // Ensure that the display link is associated with the correct display. |
428 void UpdateDisplayLink(); | 490 void UpdateDisplayLink(); |
429 | 491 |
| 492 // The scale factor of the backing store. Note that this is updated based on |
| 493 // ViewScaleFactor with some delay. |
| 494 float backing_store_scale_factor_; |
| 495 |
| 496 void AddPendingLatencyInfo( |
| 497 const std::vector<ui::LatencyInfo>& latency_info); |
| 498 void SendPendingLatencyInfoToHost(); |
| 499 |
| 500 void SendPendingSwapAck(); |
| 501 |
430 void PauseForPendingResizeOrRepaintsAndDraw(); | 502 void PauseForPendingResizeOrRepaintsAndDraw(); |
431 | 503 |
| 504 // The geometric arrangement of the layers depends on cocoa_view's size, the |
| 505 // compositing IOSurface's rounded size, and the software frame size. Update |
| 506 // all of them using this function when any of those parameters changes. Also |
| 507 // update the scale factor of the layers. |
| 508 void LayoutLayers(); |
| 509 |
432 // DelegatedFrameHostClient implementation. | 510 // DelegatedFrameHostClient implementation. |
433 virtual ui::Compositor* GetCompositor() const OVERRIDE; | 511 virtual ui::Compositor* GetCompositor() const OVERRIDE; |
434 virtual ui::Layer* GetLayer() OVERRIDE; | 512 virtual ui::Layer* GetLayer() OVERRIDE; |
435 virtual RenderWidgetHostImpl* GetHost() OVERRIDE; | 513 virtual RenderWidgetHostImpl* GetHost() OVERRIDE; |
436 virtual void SchedulePaintInRect( | 514 virtual void SchedulePaintInRect( |
437 const gfx::Rect& damage_rect_in_dip) OVERRIDE; | 515 const gfx::Rect& damage_rect_in_dip) OVERRIDE; |
438 virtual bool IsVisible() OVERRIDE; | 516 virtual bool IsVisible() OVERRIDE; |
439 virtual scoped_ptr<ResizeLock> CreateResizeLock( | 517 virtual scoped_ptr<ResizeLock> CreateResizeLock( |
440 bool defer_compositor_lock) OVERRIDE; | 518 bool defer_compositor_lock) OVERRIDE; |
441 virtual gfx::Size DesiredFrameSize() OVERRIDE; | 519 virtual gfx::Size DesiredFrameSize() OVERRIDE; |
442 virtual float CurrentDeviceScaleFactor() OVERRIDE; | 520 virtual float CurrentDeviceScaleFactor() OVERRIDE; |
443 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE; | 521 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE; |
444 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; | 522 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; |
445 | 523 |
446 // BrowserCompositorViewMacClient implementation. | 524 // BrowserCompositorViewMacClient implementation. |
447 virtual bool BrowserCompositorViewShouldAckImmediately() const OVERRIDE; | 525 virtual bool BrowserCompositorViewShouldAckImmediately() const OVERRIDE; |
448 virtual void BrowserCompositorViewFrameSwapped( | 526 virtual void BrowserCompositorViewFrameSwapped( |
449 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; | 527 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; |
450 virtual NSView* BrowserCompositorSuperview() OVERRIDE; | 528 virtual NSView* BrowserCompositorSuperview() OVERRIDE; |
451 virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; | 529 virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; |
452 | 530 |
453 private: | 531 private: |
454 friend class RenderWidgetHostViewMacTest; | 532 friend class RenderWidgetHostViewMacTest; |
455 | 533 |
| 534 struct PendingSwapAck { |
| 535 PendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id) |
| 536 : route_id(route_id), |
| 537 gpu_host_id(gpu_host_id), |
| 538 renderer_id(renderer_id) {} |
| 539 int32 route_id; |
| 540 int gpu_host_id; |
| 541 int32 renderer_id; |
| 542 }; |
| 543 scoped_ptr<PendingSwapAck> pending_swap_ack_; |
| 544 void AddPendingSwapAck(int32 route_id, int gpu_host_id, int32 renderer_id); |
| 545 |
456 // Returns whether this render view is a popup (autocomplete window). | 546 // Returns whether this render view is a popup (autocomplete window). |
457 bool IsPopup() const; | 547 bool IsPopup() const; |
458 | 548 |
459 // Shuts down the render_widget_host_. This is a separate function so we can | 549 // Shuts down the render_widget_host_. This is a separate function so we can |
460 // invoke it from the message loop. | 550 // invoke it from the message loop. |
461 void ShutdownHost(); | 551 void ShutdownHost(); |
462 | 552 |
463 // Tear down all components of the browser compositor in an order that will | 553 // Tear down all components of the browser compositor in an order that will |
464 // ensure no dangling references. | 554 // ensure no dangling references. |
465 void ShutdownBrowserCompositor(); | 555 void ShutdownBrowserCompositor(); |
466 | 556 |
467 void EnsureBrowserCompositorView(); | 557 void EnsureBrowserCompositorView(); |
468 void DestroyBrowserCompositorView(); | 558 void DestroyBrowserCompositorView(); |
469 | 559 |
| 560 void EnsureSoftwareLayer(); |
| 561 void DestroySoftwareLayer(); |
| 562 |
| 563 bool EnsureCompositedIOSurface() WARN_UNUSED_RESULT; |
| 564 void EnsureCompositedIOSurfaceLayer(); |
| 565 enum DestroyCompositedIOSurfaceLayerBehavior { |
| 566 kLeaveLayerInHierarchy, |
| 567 kRemoveLayerFromHierarchy, |
| 568 }; |
| 569 void DestroyCompositedIOSurfaceLayer( |
| 570 DestroyCompositedIOSurfaceLayerBehavior destroy_layer_behavior); |
| 571 void DestroyCompositedIOSurfaceAndLayer(); |
| 572 |
| 573 void DestroyCompositingStateOnError(); |
| 574 |
| 575 // Called when a GPU SwapBuffers is received. |
| 576 void GotAcceleratedFrame(); |
| 577 |
| 578 // Called when a software DIB is received. |
| 579 void GotSoftwareFrame(); |
| 580 |
470 // IPC message handlers. | 581 // IPC message handlers. |
471 void OnPluginFocusChanged(bool focused, int plugin_id); | 582 void OnPluginFocusChanged(bool focused, int plugin_id); |
472 void OnStartPluginIme(); | 583 void OnStartPluginIme(); |
473 void OnGetRenderedTextCompleted(const std::string& text); | 584 void OnGetRenderedTextCompleted(const std::string& text); |
474 | 585 |
| 586 // Convert |rect| from the views coordinate (upper-left origin) into |
| 587 // the OpenGL coordinate (lower-left origin) and scale for HiDPI displays. |
| 588 gfx::Rect GetScaledOpenGLPixelRect(const gfx::Rect& rect); |
| 589 |
475 // Send updated vsync parameters to the renderer. | 590 // Send updated vsync parameters to the renderer. |
476 void SendVSyncParametersToRenderer(); | 591 void SendVSyncParametersToRenderer(); |
477 | 592 |
478 // Dispatches a TTS session. | 593 // Dispatches a TTS session. |
479 void SpeakText(const std::string& text); | 594 void SpeakText(const std::string& text); |
480 | 595 |
481 // The associated view. This is weak and is inserted into the view hierarchy | 596 // The associated view. This is weak and is inserted into the view hierarchy |
482 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 597 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
483 // destructor. | 598 // destructor. |
484 RenderWidgetHostViewCocoa* cocoa_view_; | 599 RenderWidgetHostViewCocoa* cocoa_view_; |
(...skipping 30 matching lines...) Expand all Loading... |
515 base::TimeTicks vsync_timebase_; | 630 base::TimeTicks vsync_timebase_; |
516 base::TimeDelta vsync_interval_; | 631 base::TimeDelta vsync_interval_; |
517 | 632 |
518 // The current composition character range and its bounds. | 633 // The current composition character range and its bounds. |
519 gfx::Range composition_range_; | 634 gfx::Range composition_range_; |
520 std::vector<gfx::Rect> composition_bounds_; | 635 std::vector<gfx::Rect> composition_bounds_; |
521 | 636 |
522 // The current caret bounds. | 637 // The current caret bounds. |
523 gfx::Rect caret_rect_; | 638 gfx::Rect caret_rect_; |
524 | 639 |
| 640 // Subscriber that listens to frame presentation events. |
| 641 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
| 642 |
| 643 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 644 software_frame_weak_ptr_factory_; |
525 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 645 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
526 }; | 646 }; |
527 | 647 |
528 } // namespace content | 648 } // namespace content |
529 | 649 |
530 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 650 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |