| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || | 77 can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
| 78 can_lock_compositor_ == NO_PENDING_COMMIT; | 78 can_lock_compositor_ == NO_PENDING_COMMIT; |
| 79 | 79 |
| 80 if (can_lock_compositor_ == YES_CAN_LOCK) | 80 if (can_lock_compositor_ == YES_CAN_LOCK) |
| 81 can_lock_compositor_ = YES_DID_LOCK; | 81 can_lock_compositor_ = YES_DID_LOCK; |
| 82 | 82 |
| 83 resize_lock_ = client_->CreateResizeLock(defer_compositor_lock); | 83 resize_lock_ = client_->CreateResizeLock(defer_compositor_lock); |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool DelegatedFrameHost::ShouldCreateResizeLock() { | 86 bool DelegatedFrameHost::ShouldCreateResizeLock() { |
| 87 // On Windows while resizing, the the resize locks makes us mis-paint a white | 87 // On Windows and Linux, holding pointer moves will not help throttling |
| 88 // vertical strip (including the non-client area) if the content composition | 88 // resizes. |
| 89 // is lagging the UI composition. So here we disable the throttling so that | 89 // TODO(piman): on Windows we need to block (nested message loop?) the |
| 90 // the UI bits can draw ahead of the content thereby reducing the amount of | 90 // WM_SIZE event. On Linux we need to throttle at the WM level using |
| 91 // whiteout. Because this causes the content to be drawn at wrong sizes while | 91 // _NET_WM_SYNC_REQUEST. |
| 92 // resizing we compensate by blocking the UI thread in Compositor::Draw() by | |
| 93 // issuing a FinishAllRendering() if we are resizing. | |
| 94 // TODO(ccameron): Mac browser window resizing is incompletely implemented. | 92 // TODO(ccameron): Mac browser window resizing is incompletely implemented. |
| 95 #if defined(OS_WIN) || defined(OS_MACOSX) | 93 #if !defined(OS_CHROMEOS) |
| 96 return false; | 94 return false; |
| 97 #else | 95 #else |
| 98 RenderWidgetHostImpl* host = client_->GetHost(); | 96 RenderWidgetHostImpl* host = client_->GetHost(); |
| 99 | 97 |
| 100 if (resize_lock_) | 98 if (resize_lock_) |
| 101 return false; | 99 return false; |
| 102 | 100 |
| 103 if (host->should_auto_resize()) | 101 if (host->should_auto_resize()) |
| 104 return false; | 102 return false; |
| 105 if (!host->is_accelerated_compositing_active()) | 103 if (!host->is_accelerated_compositing_active()) |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 // that should keep our frame. old_layer will be returned to the | 867 // that should keep our frame. old_layer will be returned to the |
| 870 // RecreateLayer caller, and should have a copy. | 868 // RecreateLayer caller, and should have a copy. |
| 871 if (frame_provider_.get()) { | 869 if (frame_provider_.get()) { |
| 872 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 870 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
| 873 current_frame_size_in_dip_); | 871 current_frame_size_in_dip_); |
| 874 } | 872 } |
| 875 } | 873 } |
| 876 | 874 |
| 877 } // namespace content | 875 } // namespace content |
| 878 | 876 |
| OLD | NEW |