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

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

Issue 1963263002: Fix Mac resize, delete more Mac code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor(); 269 return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor();
270 } 270 }
271 271
272 void GpuProcessTransportFactory::CreateOutputSurface( 272 void GpuProcessTransportFactory::CreateOutputSurface(
273 base::WeakPtr<ui::Compositor> compositor) { 273 base::WeakPtr<ui::Compositor> compositor) {
274 DCHECK(!!compositor); 274 DCHECK(!!compositor);
275 PerCompositorData* data = per_compositor_data_[compositor.get()]; 275 PerCompositorData* data = per_compositor_data_[compositor.get()];
276 if (!data) { 276 if (!data) {
277 data = CreatePerCompositorData(compositor.get()); 277 data = CreatePerCompositorData(compositor.get());
278 } else { 278 } else {
279 #if defined(OS_MACOSX)
280 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an
281 // output_surface_map_ here.
282 output_surface_map_.Remove(data->surface_handle);
283 #endif
284 data->surface = nullptr; 279 data->surface = nullptr;
285 } 280 }
286 281
287 #if defined(OS_WIN) 282 #if defined(OS_WIN)
288 gfx::RenderingWindowManager::GetInstance()->UnregisterParent( 283 gfx::RenderingWindowManager::GetInstance()->UnregisterParent(
289 compositor->widget()); 284 compositor->widget());
290 #endif 285 #endif
291 286
292 const bool use_vulkan = SharedVulkanContextProvider(); 287 const bool use_vulkan = SharedVulkanContextProvider();
293 288
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 validator = CreateOverlayCandidateValidator(compositor->widget()); 464 validator = CreateOverlayCandidateValidator(compositor->widget());
470 #endif 465 #endif
471 surface = base::WrapUnique(new GpuBrowserCompositorOutputSurface( 466 surface = base::WrapUnique(new GpuBrowserCompositorOutputSurface(
472 context_provider, shared_worker_context_provider_, 467 context_provider, shared_worker_context_provider_,
473 compositor->vsync_manager(), compositor->task_runner().get(), 468 compositor->vsync_manager(), compositor->task_runner().get(),
474 std::move(validator))); 469 std::move(validator)));
475 } 470 }
476 } 471 }
477 } 472 }
478 473
479 #if defined(OS_MACOSX)
480 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an
481 // output_surface_map_ here.
482 output_surface_map_.AddWithID(surface.get(), data->surface_handle);
483 #endif
484 data->surface = surface.get(); 474 data->surface = surface.get();
485 if (data->reflector) 475 if (data->reflector)
486 data->reflector->OnSourceSurfaceReady(data->surface); 476 data->reflector->OnSourceSurfaceReady(data->surface);
487 477
488 #if defined(OS_WIN) 478 #if defined(OS_WIN)
489 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( 479 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild(
490 compositor->widget()); 480 compositor->widget());
491 #endif 481 #endif
492 482
493 // This gets a bit confusing. Here we have a ContextProvider in the |surface| 483 // This gets a bit confusing. Here we have a ContextProvider in the |surface|
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 data->reflector->Shutdown(); 530 data->reflector->Shutdown();
541 data->reflector = nullptr; 531 data->reflector = nullptr;
542 } 532 }
543 533
544 void GpuProcessTransportFactory::RemoveCompositor(ui::Compositor* compositor) { 534 void GpuProcessTransportFactory::RemoveCompositor(ui::Compositor* compositor) {
545 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); 535 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
546 if (it == per_compositor_data_.end()) 536 if (it == per_compositor_data_.end())
547 return; 537 return;
548 PerCompositorData* data = it->second; 538 PerCompositorData* data = it->second;
549 DCHECK(data); 539 DCHECK(data);
550 #if defined(OS_MACOSX)
551 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an
552 // output_surface_map_ here.
553 if (data->surface)
554 output_surface_map_.Remove(data->surface_handle);
555 #endif
556 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) 540 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW)
557 if (data->surface_handle) 541 if (data->surface_handle)
558 GpuSurfaceTracker::Get()->RemoveSurface(data->surface_handle); 542 GpuSurfaceTracker::Get()->RemoveSurface(data->surface_handle);
559 #endif 543 #endif
560 delete data; 544 delete data;
561 per_compositor_data_.erase(it); 545 per_compositor_data_.erase(it);
562 if (per_compositor_data_.empty()) { 546 if (per_compositor_data_.empty()) {
563 // Destroying the GLHelper may cause some async actions to be cancelled, 547 // Destroying the GLHelper may cause some async actions to be cancelled,
564 // causing things to request a new GLHelper. Due to crbug.com/176091 the 548 // causing things to request a new GLHelper. Due to crbug.com/176091 the
565 // GLHelper created in this case would be lost/leaked if we just reset() 549 // GLHelper created in this case would be lost/leaked if we just reset()
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 ui::Compositor* compositor, 656 ui::Compositor* compositor,
673 bool suspended) { 657 bool suspended) {
674 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); 658 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
675 if (it == per_compositor_data_.end()) 659 if (it == per_compositor_data_.end())
676 return; 660 return;
677 PerCompositorData* data = it->second; 661 PerCompositorData* data = it->second;
678 DCHECK(data); 662 DCHECK(data);
679 if (data->surface) 663 if (data->surface)
680 data->surface->SetSurfaceSuspendedForRecycle(suspended); 664 data->surface->SetSurfaceSuspendedForRecycle(suspended);
681 } 665 }
682
683 bool GpuProcessTransportFactory::
684 SurfaceShouldNotShowFramesAfterSuspendForRecycle(
685 gpu::SurfaceHandle surface_handle) const {
686 BrowserCompositorOutputSurface* surface =
687 output_surface_map_.Lookup(surface_handle);
688 if (surface)
689 return surface->SurfaceShouldNotShowFramesAfterSuspendForRecycle();
690 return false;
691 }
692 #endif 666 #endif
693 667
694 scoped_refptr<cc::ContextProvider> 668 scoped_refptr<cc::ContextProvider>
695 GpuProcessTransportFactory::SharedMainThreadContextProvider() { 669 GpuProcessTransportFactory::SharedMainThreadContextProvider() {
696 if (shared_main_thread_contexts_) 670 if (shared_main_thread_contexts_)
697 return shared_main_thread_contexts_; 671 return shared_main_thread_contexts_;
698 672
699 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) 673 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor())
700 return nullptr; 674 return nullptr;
701 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( 675 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 shared_vulkan_context_provider_ = 759 shared_vulkan_context_provider_ =
786 cc::VulkanInProcessContextProvider::Create(); 760 cc::VulkanInProcessContextProvider::Create();
787 } 761 }
788 762
789 shared_vulkan_context_provider_initialized_ = true; 763 shared_vulkan_context_provider_initialized_ = true;
790 } 764 }
791 return shared_vulkan_context_provider_; 765 return shared_vulkan_context_provider_;
792 } 766 }
793 767
794 } // namespace content 768 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698