| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 !resize_lock_.get()) | 221 !resize_lock_.get()) |
| 222 return false; | 222 return false; |
| 223 | 223 |
| 224 return size_in_dip != resize_lock_->expected_size(); | 224 return size_in_dip != resize_lock_->expected_size(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void DelegatedFrameHost::WasResized() { | 227 void DelegatedFrameHost::WasResized() { |
| 228 MaybeCreateResizeLock(); | 228 MaybeCreateResizeLock(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 gfx::Size DelegatedFrameHost::GetRequestedRendererSize() const { |
| 232 if (resize_lock_) |
| 233 return resize_lock_->expected_size(); |
| 234 else |
| 235 return client_->DesiredFrameSize(); |
| 236 } |
| 237 |
| 231 void DelegatedFrameHost::CheckResizeLock() { | 238 void DelegatedFrameHost::CheckResizeLock() { |
| 232 if (!resize_lock_ || | 239 if (!resize_lock_ || |
| 233 resize_lock_->expected_size() != current_frame_size_in_dip_) | 240 resize_lock_->expected_size() != current_frame_size_in_dip_) |
| 234 return; | 241 return; |
| 235 | 242 |
| 236 // Since we got the size we were looking for, unlock the compositor. But delay | 243 // Since we got the size we were looking for, unlock the compositor. But delay |
| 237 // the release of the lock until we've kicked a frame with the new texture, to | 244 // the release of the lock until we've kicked a frame with the new texture, to |
| 238 // avoid resizing the UI before we have a chance to draw a "good" frame. | 245 // avoid resizing the UI before we have a chance to draw a "good" frame. |
| 239 resize_lock_->UnlockCompositor(); | 246 resize_lock_->UnlockCompositor(); |
| 240 ui::Compositor* compositor = client_->GetCompositor(); | 247 ui::Compositor* compositor = client_->GetCompositor(); |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 // that should keep our frame. old_layer will be returned to the | 860 // that should keep our frame. old_layer will be returned to the |
| 854 // RecreateLayer caller, and should have a copy. | 861 // RecreateLayer caller, and should have a copy. |
| 855 if (frame_provider_.get()) { | 862 if (frame_provider_.get()) { |
| 856 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 863 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
| 857 current_frame_size_in_dip_); | 864 current_frame_size_in_dip_); |
| 858 } | 865 } |
| 859 } | 866 } |
| 860 | 867 |
| 861 } // namespace content | 868 } // namespace content |
| 862 | 869 |
| OLD | NEW |