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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 surface_factory_->Destroy(surface_id_); | 372 surface_factory_->Destroy(surface_id_); |
373 surface_id_ = id_allocator_->GenerateId(); | 373 surface_id_ = id_allocator_->GenerateId(); |
374 surface_factory_->Create(surface_id_, frame_size); | 374 surface_factory_->Create(surface_id_, frame_size); |
375 client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip); | 375 client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip); |
376 current_surface_size_ = frame_size; | 376 current_surface_size_ = frame_size; |
377 modified_layers = true; | 377 modified_layers = true; |
378 } | 378 } |
379 scoped_ptr<cc::CompositorFrame> compositor_frame = | 379 scoped_ptr<cc::CompositorFrame> compositor_frame = |
380 make_scoped_ptr(new cc::CompositorFrame()); | 380 make_scoped_ptr(new cc::CompositorFrame()); |
381 compositor_frame->delegated_frame_data = frame_data.Pass(); | 381 compositor_frame->delegated_frame_data = frame_data.Pass(); |
382 surface_factory_->SubmitFrame(surface_id_, compositor_frame.Pass()); | 382 surface_factory_->SubmitFrame( |
| 383 surface_id_, |
| 384 compositor_frame.Pass(), |
| 385 base::Bind(&DelegatedFrameHost::SendDelegatedFrameAck, |
| 386 AsWeakPtr(), |
| 387 output_surface_id)); |
383 } else { | 388 } else { |
384 if (!resource_collection_) { | 389 if (!resource_collection_) { |
385 resource_collection_ = new cc::DelegatedFrameResourceCollection; | 390 resource_collection_ = new cc::DelegatedFrameResourceCollection; |
386 resource_collection_->SetClient(this); | 391 resource_collection_->SetClient(this); |
387 } | 392 } |
388 // If the physical frame size changes, we need a new |frame_provider_|. If | 393 // If the physical frame size changes, we need a new |frame_provider_|. If |
389 // the physical frame size is the same, but the size in DIP changed, we | 394 // the physical frame size is the same, but the size in DIP changed, we |
390 // need to adjust the scale at which the frames will be drawn, and we do | 395 // need to adjust the scale at which the frames will be drawn, and we do |
391 // this by making a new |frame_provider_| also to ensure the scale change | 396 // this by making a new |frame_provider_| also to ensure the scale change |
392 // is presented in sync with the new frame content. | 397 // is presented in sync with the new frame content. |
(...skipping 16 matching lines...) Expand all Loading... |
409 | 414 |
410 if (modified_layers) { | 415 if (modified_layers) { |
411 // TODO(jbauman): Need to always tell the window observer about the | 416 // TODO(jbauman): Need to always tell the window observer about the |
412 // damage. | 417 // damage. |
413 client_->SchedulePaintInRect(damage_rect_in_dip); | 418 client_->SchedulePaintInRect(damage_rect_in_dip); |
414 } | 419 } |
415 | 420 |
416 pending_delegated_ack_count_++; | 421 pending_delegated_ack_count_++; |
417 | 422 |
418 ui::Compositor* compositor = client_->GetCompositor(); | 423 ui::Compositor* compositor = client_->GetCompositor(); |
419 if (!compositor || !modified_layers) { | 424 if (!compositor) { |
420 SendDelegatedFrameAck(output_surface_id); | 425 SendDelegatedFrameAck(output_surface_id); |
421 } else { | 426 } else if (!use_surfaces_) { |
422 std::vector<ui::LatencyInfo>::const_iterator it; | 427 std::vector<ui::LatencyInfo>::const_iterator it; |
423 for (it = latency_info.begin(); it != latency_info.end(); ++it) | 428 for (it = latency_info.begin(); it != latency_info.end(); ++it) |
424 compositor->SetLatencyInfo(*it); | 429 compositor->SetLatencyInfo(*it); |
425 // If we've previously skipped any latency infos add them. | 430 // If we've previously skipped any latency infos add them. |
426 for (it = skipped_latency_info_list_.begin(); | 431 for (it = skipped_latency_info_list_.begin(); |
427 it != skipped_latency_info_list_.end(); | 432 it != skipped_latency_info_list_.end(); |
428 ++it) | 433 ++it) |
429 compositor->SetLatencyInfo(*it); | 434 compositor->SetLatencyInfo(*it); |
430 skipped_latency_info_list_.clear(); | 435 skipped_latency_info_list_.clear(); |
431 AddOnCommitCallbackAndDisableLocks( | 436 AddOnCommitCallbackAndDisableLocks( |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 if (frame_provider_.get()) { | 931 if (frame_provider_.get()) { |
927 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 932 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
928 current_frame_size_in_dip_); | 933 current_frame_size_in_dip_); |
929 } | 934 } |
930 if (!surface_id_.is_null()) { | 935 if (!surface_id_.is_null()) { |
931 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); | 936 new_layer->SetShowSurface(surface_id_, current_frame_size_in_dip_); |
932 } | 937 } |
933 } | 938 } |
934 | 939 |
935 } // namespace content | 940 } // namespace content |
OLD | NEW |