| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |