Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: content/browser/compositor/delegated_frame_host.cc

Issue 1450083002: Revert "Fix NTP thumbnail generation" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove thumbnailing context unittest. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (resource_collection_.get()) { 372 if (resource_collection_.get()) {
373 resource_collection_->SetClient(NULL); 373 resource_collection_->SetClient(NULL);
374 374
375 if (resource_collection_->LoseAllResources()) 375 if (resource_collection_->LoseAllResources())
376 SendReturnedDelegatedResources(last_output_surface_id_); 376 SendReturnedDelegatedResources(last_output_surface_id_);
377 377
378 resource_collection_ = NULL; 378 resource_collection_ = NULL;
379 } 379 }
380 last_output_surface_id_ = output_surface_id; 380 last_output_surface_id_ = output_surface_id;
381 } 381 }
382 bool skip_frame_size_mismatch = false; 382 bool immediate_ack = !compositor_;
383 pending_delegated_ack_count_++; 383 pending_delegated_ack_count_++;
384 384
385 if (frame_size.IsEmpty()) { 385 if (frame_size.IsEmpty()) {
386 DCHECK(frame_data->resource_list.empty()); 386 DCHECK(frame_data->resource_list.empty());
387 EvictDelegatedFrame(); 387 EvictDelegatedFrame();
388 } else { 388 } else {
389 if (use_surfaces_) { 389 if (use_surfaces_) {
390 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 390 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
391 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 391 cc::SurfaceManager* manager = factory->GetSurfaceManager();
392 if (!surface_factory_) { 392 if (!surface_factory_) {
(...skipping 21 matching lines...) Expand all
414 414
415 compositor_frame->metadata.latency_info.swap(skipped_latency_info_list_); 415 compositor_frame->metadata.latency_info.swap(skipped_latency_info_list_);
416 compositor_frame->metadata.latency_info.insert( 416 compositor_frame->metadata.latency_info.insert(
417 compositor_frame->metadata.latency_info.end(), 417 compositor_frame->metadata.latency_info.end(),
418 latency_info.begin(), 418 latency_info.begin(),
419 latency_info.end()); 419 latency_info.end());
420 compositor_frame->metadata.satisfies_sequences.swap(*satisfies_sequences); 420 compositor_frame->metadata.satisfies_sequences.swap(*satisfies_sequences);
421 421
422 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); 422 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP();
423 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) 423 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty())
424 skip_frame_size_mismatch = true; 424 immediate_ack = true;
425 425
426 cc::SurfaceFactory::DrawCallback ack_callback; 426 cc::SurfaceFactory::DrawCallback ack_callback;
427 if (compositor_ && !skip_frame_size_mismatch) { 427 if (compositor_ && !immediate_ack) {
428 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, 428 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn,
429 AsWeakPtr(), output_surface_id); 429 AsWeakPtr(), output_surface_id);
430 } 430 }
431 surface_factory_->SubmitCompositorFrame( 431 surface_factory_->SubmitCompositorFrame(
432 surface_id_, compositor_frame.Pass(), ack_callback); 432 surface_id_, compositor_frame.Pass(), ack_callback);
433 } else { 433 } else {
434 if (!resource_collection_.get()) { 434 if (!resource_collection_.get()) {
435 resource_collection_ = new cc::DelegatedFrameResourceCollection; 435 resource_collection_ = new cc::DelegatedFrameResourceCollection;
436 resource_collection_->SetClient(this); 436 resource_collection_->SetClient(this);
437 } 437 }
(...skipping 15 matching lines...) Expand all
453 } 453 }
454 } 454 }
455 released_front_lock_ = NULL; 455 released_front_lock_ = NULL;
456 current_frame_size_in_dip_ = frame_size_in_dip; 456 current_frame_size_in_dip_ = frame_size_in_dip;
457 CheckResizeLock(); 457 CheckResizeLock();
458 458
459 if (!damage_rect_in_dip.IsEmpty()) 459 if (!damage_rect_in_dip.IsEmpty())
460 client_->DelegatedFrameHostGetLayer()->OnDelegatedFrameDamage( 460 client_->DelegatedFrameHostGetLayer()->OnDelegatedFrameDamage(
461 damage_rect_in_dip); 461 damage_rect_in_dip);
462 462
463 // Note that |compositor_| may be reset by SetShowSurface or 463 if (immediate_ack) {
464 // SetShowDelegatedContent above.
465 if (!compositor_ || skip_frame_size_mismatch) {
466 SendDelegatedFrameAck(output_surface_id); 464 SendDelegatedFrameAck(output_surface_id);
467 } else if (!use_surfaces_) { 465 } else if (!use_surfaces_) {
468 std::vector<ui::LatencyInfo>::const_iterator it; 466 std::vector<ui::LatencyInfo>::const_iterator it;
469 for (it = latency_info.begin(); it != latency_info.end(); ++it) 467 for (it = latency_info.begin(); it != latency_info.end(); ++it)
470 compositor_->SetLatencyInfo(*it); 468 compositor_->SetLatencyInfo(*it);
471 // If we've previously skipped any latency infos add them. 469 // If we've previously skipped any latency infos add them.
472 for (it = skipped_latency_info_list_.begin(); 470 for (it = skipped_latency_info_list_.begin();
473 it != skipped_latency_info_list_.end(); 471 it != skipped_latency_info_list_.end();
474 ++it) 472 ++it)
475 compositor_->SetLatencyInfo(*it); 473 compositor_->SetLatencyInfo(*it);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1041 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1044 new_layer->SetShowSurface( 1042 new_layer->SetShowSurface(
1045 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 1043 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
1046 base::Bind(&RequireCallback, base::Unretained(manager)), 1044 base::Bind(&RequireCallback, base::Unretained(manager)),
1047 current_surface_size_, current_scale_factor_, 1045 current_surface_size_, current_scale_factor_,
1048 current_frame_size_in_dip_); 1046 current_frame_size_in_dip_);
1049 } 1047 }
1050 } 1048 }
1051 1049
1052 } // namespace content 1050 } // namespace content
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | content/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698