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

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

Issue 1097223002: Mac: Fix black flashing during tab switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait for swap to draw frames Created 5 years, 8 months 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/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 462 }
463 463
464 #if defined(OS_MACOSX) 464 #if defined(OS_MACOSX)
465 void GpuProcessTransportFactory::OnSurfaceDisplayed(int surface_id) { 465 void GpuProcessTransportFactory::OnSurfaceDisplayed(int surface_id) {
466 BrowserCompositorOutputSurface* surface = output_surface_map_.Lookup( 466 BrowserCompositorOutputSurface* surface = output_surface_map_.Lookup(
467 surface_id); 467 surface_id);
468 if (surface) 468 if (surface)
469 surface->OnSurfaceDisplayed(); 469 surface->OnSurfaceDisplayed();
470 } 470 }
471 471
472 void GpuProcessTransportFactory::OnCompositorRecycled( 472 void GpuProcessTransportFactory::SetCompositorSuspendedForRecycle(
473 ui::Compositor* compositor) { 473 ui::Compositor* compositor,
474 bool suspended) {
474 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); 475 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
475 if (it == per_compositor_data_.end()) 476 if (it == per_compositor_data_.end())
476 return; 477 return;
477 PerCompositorData* data = it->second; 478 PerCompositorData* data = it->second;
478 DCHECK(data); 479 DCHECK(data);
479 BrowserCompositorOutputSurface* surface = 480 BrowserCompositorOutputSurface* surface =
480 output_surface_map_.Lookup(data->surface_id); 481 output_surface_map_.Lookup(data->surface_id);
481 if (surface) 482 if (surface)
482 surface->OnSurfaceRecycled(); 483 surface->SetSurfaceSuspendedForRecycle(suspended);
483 } 484 }
484 485
485 bool GpuProcessTransportFactory::SurfaceShouldNotShowFramesAfterRecycle( 486 bool GpuProcessTransportFactory::
486 int surface_id) const { 487 SurfaceShouldNotShowFramesAfterSuspendForRecycle(int surface_id) const {
487 BrowserCompositorOutputSurface* surface = 488 BrowserCompositorOutputSurface* surface =
488 output_surface_map_.Lookup(surface_id); 489 output_surface_map_.Lookup(surface_id);
489 if (surface) 490 if (surface)
490 return surface->ShouldNotShowFramesAfterRecycle(); 491 return surface->SurfaceShouldNotShowFramesAfterSuspendForRecycle();
491 return false; 492 return false;
492 } 493 }
493 #endif 494 #endif
494 495
495 scoped_refptr<cc::ContextProvider> 496 scoped_refptr<cc::ContextProvider>
496 GpuProcessTransportFactory::SharedMainThreadContextProvider() { 497 GpuProcessTransportFactory::SharedMainThreadContextProvider() {
497 if (shared_main_thread_contexts_.get()) 498 if (shared_main_thread_contexts_.get())
498 return shared_main_thread_contexts_; 499 return shared_main_thread_contexts_;
499 500
500 // In threaded compositing mode, we have to create our own context for the 501 // In threaded compositing mode, we have to create our own context for the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 589 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
589 observer_list_, 590 observer_list_,
590 OnLostResources()); 591 OnLostResources());
591 592
592 // Kill things that use the shared context before killing the shared context. 593 // Kill things that use the shared context before killing the shared context.
593 lost_gl_helper.reset(); 594 lost_gl_helper.reset();
594 lost_shared_main_thread_contexts = NULL; 595 lost_shared_main_thread_contexts = NULL;
595 } 596 }
596 597
597 } // namespace content 598 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.h ('k') | content/browser/compositor/image_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698