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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 is_loading_ = is_loading; | 504 is_loading_ = is_loading; |
505 if (!view_) | 505 if (!view_) |
506 return; | 506 return; |
507 view_->SetIsLoading(is_loading); | 507 view_->SetIsLoading(is_loading); |
508 } | 508 } |
509 | 509 |
510 void RenderWidgetHostImpl::WasHidden() { | 510 void RenderWidgetHostImpl::WasHidden() { |
511 if (is_hidden_) | 511 if (is_hidden_) |
512 return; | 512 return; |
513 | 513 |
514 TRACE_EVENT0("browser", "RenderWidgetHostImpl::WasHidden"); | |
no sievers
2015/03/25 21:56:10
maybe this should be in the 'renderer_host' catego
jdduke (slow)
2015/03/25 22:19:23
Absolutely, I even had that in my local branch =/.
| |
514 is_hidden_ = true; | 515 is_hidden_ = true; |
515 | 516 |
516 // Don't bother reporting hung state when we aren't active. | 517 // Don't bother reporting hung state when we aren't active. |
517 StopHangMonitorTimeout(); | 518 StopHangMonitorTimeout(); |
518 | 519 |
519 // If we have a renderer, then inform it that we are being hidden so it can | 520 // If we have a renderer, then inform it that we are being hidden so it can |
520 // reduce its resource utilization. | 521 // reduce its resource utilization. |
521 Send(new ViewMsg_WasHidden(routing_id_)); | 522 Send(new ViewMsg_WasHidden(routing_id_)); |
522 | 523 |
523 // Tell the RenderProcessHost we were hidden. | 524 // Tell the RenderProcessHost we were hidden. |
524 process_->WidgetHidden(); | 525 process_->WidgetHidden(); |
525 | 526 |
526 bool is_visible = false; | 527 bool is_visible = false; |
527 NotificationService::current()->Notify( | 528 NotificationService::current()->Notify( |
528 NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 529 NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
529 Source<RenderWidgetHost>(this), | 530 Source<RenderWidgetHost>(this), |
530 Details<bool>(&is_visible)); | 531 Details<bool>(&is_visible)); |
531 } | 532 } |
532 | 533 |
533 void RenderWidgetHostImpl::WasShown(const ui::LatencyInfo& latency_info) { | 534 void RenderWidgetHostImpl::WasShown(const ui::LatencyInfo& latency_info) { |
534 if (!is_hidden_) | 535 if (!is_hidden_) |
535 return; | 536 return; |
537 | |
538 TRACE_EVENT0("browser", "RenderWidgetHostImpl::WasShown"); | |
536 is_hidden_ = false; | 539 is_hidden_ = false; |
537 | 540 |
538 SendScreenRects(); | 541 SendScreenRects(); |
539 | 542 |
540 // When hidden, timeout monitoring for input events is disabled. Restore it | 543 // When hidden, timeout monitoring for input events is disabled. Restore it |
541 // now to ensure consistent hang detection. | 544 // now to ensure consistent hang detection. |
542 if (in_flight_event_count_) | 545 if (in_flight_event_count_) |
543 RestartHangMonitorTimeout(); | 546 RestartHangMonitorTimeout(); |
544 | 547 |
545 // Always repaint on restore. | 548 // Always repaint on restore. |
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2119 } | 2122 } |
2120 #endif | 2123 #endif |
2121 | 2124 |
2122 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2125 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2123 if (view_) | 2126 if (view_) |
2124 return view_->PreferredReadbackFormat(); | 2127 return view_->PreferredReadbackFormat(); |
2125 return kN32_SkColorType; | 2128 return kN32_SkColorType; |
2126 } | 2129 } |
2127 | 2130 |
2128 } // namespace content | 2131 } // namespace content |
OLD | NEW |