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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 /////////////////////////////////////////////////////////////////////////////// | 401 /////////////////////////////////////////////////////////////////////////////// |
402 // RenderWidgetHostViewMac, public: | 402 // RenderWidgetHostViewMac, public: |
403 | 403 |
404 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) | 404 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) |
405 : render_widget_host_(RenderWidgetHostImpl::From(widget)), | 405 : render_widget_host_(RenderWidgetHostImpl::From(widget)), |
406 about_to_validate_and_paint_(false), | 406 about_to_validate_and_paint_(false), |
407 call_set_needs_display_in_rect_pending_(false), | 407 call_set_needs_display_in_rect_pending_(false), |
408 last_frame_was_accelerated_(false), | 408 last_frame_was_accelerated_(false), |
409 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 409 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
410 can_compose_inline_(true), | 410 can_compose_inline_(true), |
411 compositing_iosurface_layer_async_timer_( | |
412 FROM_HERE, base::TimeDelta::FromMilliseconds(200), | |
Avi (use Gerrit)
2014/02/14 02:11:29
... you say 200ms here.
ccameron
2014/02/14 02:32:19
Changed to 250
| |
413 this, &RenderWidgetHostViewMac::TimerSinceGotAcceleratedFrameFired), | |
411 allow_overlapping_views_(false), | 414 allow_overlapping_views_(false), |
412 use_core_animation_(false), | 415 use_core_animation_(false), |
413 pending_latency_info_delay_(0), | 416 pending_latency_info_delay_(0), |
414 pending_latency_info_delay_weak_ptr_factory_(this), | 417 pending_latency_info_delay_weak_ptr_factory_(this), |
415 is_loading_(false), | 418 is_loading_(false), |
416 weak_factory_(this), | 419 weak_factory_(this), |
417 fullscreen_parent_host_view_(NULL), | 420 fullscreen_parent_host_view_(NULL), |
418 underlay_view_has_drawn_(false), | 421 underlay_view_has_drawn_(false), |
419 overlay_view_weak_factory_(this), | 422 overlay_view_weak_factory_(this), |
420 software_frame_weak_ptr_factory_(this) { | 423 software_frame_weak_ptr_factory_(this) { |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1398 // setNeedsDisplay will never display and we'll never ack if the window is | 1401 // setNeedsDisplay will never display and we'll never ack if the window is |
1399 // empty, so ack now and don't bother calling setNeedsDisplay below. | 1402 // empty, so ack now and don't bother calling setNeedsDisplay below. |
1400 return; | 1403 return; |
1401 } | 1404 } |
1402 | 1405 |
1403 // No need to draw the surface if we are inside a drawRect. It will be done | 1406 // No need to draw the surface if we are inside a drawRect. It will be done |
1404 // later. | 1407 // later. |
1405 if (!about_to_validate_and_paint_) { | 1408 if (!about_to_validate_and_paint_) { |
1406 if (use_core_animation_) { | 1409 if (use_core_animation_) { |
1407 DCHECK(compositing_iosurface_layer_); | 1410 DCHECK(compositing_iosurface_layer_); |
1408 [compositing_iosurface_layer_ setNeedsDisplay]; | 1411 compositing_iosurface_layer_async_timer_.Reset(); |
1412 [compositing_iosurface_layer_ gotNewFrame]; | |
1409 } else { | 1413 } else { |
1410 if (!DrawIOSurfaceWithoutCoreAnimation()) { | 1414 if (!DrawIOSurfaceWithoutCoreAnimation()) { |
1411 [cocoa_view_ setNeedsDisplay:YES]; | 1415 [cocoa_view_ setNeedsDisplay:YES]; |
1412 GotAcceleratedCompositingError(); | 1416 GotAcceleratedCompositingError(); |
1413 return; | 1417 return; |
1414 } | 1418 } |
1415 } | 1419 } |
1416 } | 1420 } |
1417 } | 1421 } |
1418 | 1422 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1896 // http://crbug.com/279472 | 1900 // http://crbug.com/279472 |
1897 if (!use_core_animation_) | 1901 if (!use_core_animation_) |
1898 [[cocoa_view_ window] disableScreenUpdatesUntilFlush]; | 1902 [[cocoa_view_ window] disableScreenUpdatesUntilFlush]; |
1899 if (allow_overlapping_views_) | 1903 if (allow_overlapping_views_) |
1900 DestroyCompositedIOSurfaceAndLayer(kLeaveContextBoundToView); | 1904 DestroyCompositedIOSurfaceAndLayer(kLeaveContextBoundToView); |
1901 else | 1905 else |
1902 DestroyCompositedIOSurfaceAndLayer(kDestroyContext); | 1906 DestroyCompositedIOSurfaceAndLayer(kDestroyContext); |
1903 } | 1907 } |
1904 } | 1908 } |
1905 | 1909 |
1910 void RenderWidgetHostViewMac::TimerSinceGotAcceleratedFrameFired() { | |
1911 [compositing_iosurface_layer_ timerSinceGotNewFrameFired]; | |
1912 } | |
1913 | |
1906 void RenderWidgetHostViewMac::SetActive(bool active) { | 1914 void RenderWidgetHostViewMac::SetActive(bool active) { |
1907 if (render_widget_host_) { | 1915 if (render_widget_host_) { |
1908 render_widget_host_->SetActive(active); | 1916 render_widget_host_->SetActive(active); |
1909 if (active) { | 1917 if (active) { |
1910 if (HasFocus()) | 1918 if (HasFocus()) |
1911 render_widget_host_->Focus(); | 1919 render_widget_host_->Focus(); |
1912 } else { | 1920 } else { |
1913 render_widget_host_->Blur(); | 1921 render_widget_host_->Blur(); |
1914 } | 1922 } |
1915 } | 1923 } |
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4093 return YES; | 4101 return YES; |
4094 } | 4102 } |
4095 | 4103 |
4096 - (BOOL)isOpaque { | 4104 - (BOOL)isOpaque { |
4097 if (renderWidgetHostView_->use_core_animation_) | 4105 if (renderWidgetHostView_->use_core_animation_) |
4098 return YES; | 4106 return YES; |
4099 return [super isOpaque]; | 4107 return [super isOpaque]; |
4100 } | 4108 } |
4101 | 4109 |
4102 @end | 4110 @end |
OLD | NEW |