| 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/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void DelegatedFrameHost::MaybeCreateResizeLock() { | 83 void DelegatedFrameHost::MaybeCreateResizeLock() { |
| 84 DCHECK(!resize_lock_); | 84 DCHECK(!resize_lock_); |
| 85 | 85 |
| 86 if (!compositor_) | 86 if (!compositor_) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 89 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 90 switches::kDisableResizeLock)) | 90 switches::kDisableResizeLock)) |
| 91 return; | 91 return; |
| 92 | 92 |
| 93 if (!has_frame_) |
| 94 return; |
| 95 |
| 93 if (!client_->DelegatedFrameCanCreateResizeLock()) | 96 if (!client_->DelegatedFrameCanCreateResizeLock()) |
| 94 return; | 97 return; |
| 95 | 98 |
| 96 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); | 99 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); |
| 97 if (desired_size.IsEmpty()) | 100 if (desired_size.IsEmpty()) |
| 98 return; | 101 return; |
| 99 if (desired_size == current_frame_size_in_dip_) | 102 if (desired_size == current_frame_size_in_dip_) |
| 100 return; | 103 return; |
| 101 | 104 |
| 102 resize_lock_ = client_->DelegatedFrameHostCreateResizeLock(); | 105 resize_lock_ = client_->DelegatedFrameHostCreateResizeLock(); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 void DelegatedFrameHost::OnBeginFrame(const cc::BeginFrameArgs& args) { | 521 void DelegatedFrameHost::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 519 client_->OnBeginFrame(args); | 522 client_->OnBeginFrame(args); |
| 520 } | 523 } |
| 521 | 524 |
| 522 void DelegatedFrameHost::EvictDelegatedFrame() { | 525 void DelegatedFrameHost::EvictDelegatedFrame() { |
| 523 if (!has_frame_) | 526 if (!has_frame_) |
| 524 return; | 527 return; |
| 525 client_->DelegatedFrameHostGetLayer()->SetShowSolidColorContent(); | 528 client_->DelegatedFrameHostGetLayer()->SetShowSolidColorContent(); |
| 526 support_->EvictFrame(); | 529 support_->EvictFrame(); |
| 527 has_frame_ = false; | 530 has_frame_ = false; |
| 531 resize_lock_.reset(); |
| 528 delegated_frame_evictor_->DiscardedFrame(); | 532 delegated_frame_evictor_->DiscardedFrame(); |
| 529 UpdateGutters(); | 533 UpdateGutters(); |
| 530 } | 534 } |
| 531 | 535 |
| 532 // static | 536 // static |
| 533 void DelegatedFrameHost::ReturnSubscriberTexture( | 537 void DelegatedFrameHost::ReturnSubscriberTexture( |
| 534 base::WeakPtr<DelegatedFrameHost> dfh, | 538 base::WeakPtr<DelegatedFrameHost> dfh, |
| 535 scoped_refptr<OwnedMailbox> subscriber_texture, | 539 scoped_refptr<OwnedMailbox> subscriber_texture, |
| 536 const gpu::SyncToken& sync_token) { | 540 const gpu::SyncToken& sync_token) { |
| 537 if (!subscriber_texture.get()) | 541 if (!subscriber_texture.get()) |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 } | 870 } |
| 867 | 871 |
| 868 if (!skipped_frames_) { | 872 if (!skipped_frames_) { |
| 869 latest_confirmed_begin_frame_source_id_ = ack.source_id; | 873 latest_confirmed_begin_frame_source_id_ = ack.source_id; |
| 870 latest_confirmed_begin_frame_sequence_number_ = | 874 latest_confirmed_begin_frame_sequence_number_ = |
| 871 ack.latest_confirmed_sequence_number; | 875 ack.latest_confirmed_sequence_number; |
| 872 } | 876 } |
| 873 } | 877 } |
| 874 | 878 |
| 875 } // namespace content | 879 } // namespace content |
| OLD | NEW |