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

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

Issue 2286273003: Make cc::Display not own its BeginFrameSource (Closed)
Patch Set: Fix webview Created 4 years, 3 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 #endif 159 #endif
160 160
161 } // namespace 161 } // namespace
162 162
163 namespace content { 163 namespace content {
164 164
165 struct GpuProcessTransportFactory::PerCompositorData { 165 struct GpuProcessTransportFactory::PerCompositorData {
166 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; 166 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle;
167 BrowserCompositorOutputSurface* display_output_surface = nullptr; 167 BrowserCompositorOutputSurface* display_output_surface = nullptr;
168 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; 168 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source;
169 ReflectorImpl* reflector = nullptr; 169 ReflectorImpl* reflector = nullptr;
170 std::unique_ptr<cc::Display> display; 170 std::unique_ptr<cc::Display> display;
171 bool output_is_secure = false; 171 bool output_is_secure = false;
172 gfx::ColorSpace color_space; 172 gfx::ColorSpace color_space;
173 }; 173 };
174 174
175 GpuProcessTransportFactory::GpuProcessTransportFactory() 175 GpuProcessTransportFactory::GpuProcessTransportFactory()
176 : next_surface_client_id_(1u), 176 : next_surface_client_id_(1u),
177 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), 177 task_graph_runner_(new cc::SingleThreadTaskGraphRunner),
178 callback_factory_(this) { 178 callback_factory_(this) {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 std::move(validator))); 521 std::move(validator)));
522 #else 522 #else
523 NOTREACHED(); 523 NOTREACHED();
524 #endif 524 #endif
525 } 525 }
526 } 526 }
527 } 527 }
528 } 528 }
529 529
530 data->display_output_surface = display_output_surface.get(); 530 data->display_output_surface = display_output_surface.get();
531 data->begin_frame_source = begin_frame_source.get();
532 if (data->reflector) 531 if (data->reflector)
533 data->reflector->OnSourceSurfaceReady(data->display_output_surface); 532 data->reflector->OnSourceSurfaceReady(data->display_output_surface);
534 533
535 #if defined(OS_WIN) 534 #if defined(OS_WIN)
536 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( 535 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild(
537 compositor->widget()); 536 compositor->widget());
538 #endif 537 #endif
539 538
540 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( 539 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler(
541 begin_frame_source.get(), compositor->task_runner().get(), 540 begin_frame_source.get(), compositor->task_runner().get(),
542 display_output_surface->capabilities().max_frames_pending)); 541 display_output_surface->capabilities().max_frames_pending));
543 542
544 // The Display owns and uses the |display_output_surface| created above. 543 // The Display owns and uses the |display_output_surface| created above.
545 data->display = base::MakeUnique<cc::Display>( 544 data->display = base::MakeUnique<cc::Display>(
546 HostSharedBitmapManager::current(), 545 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(),
547 GetGpuMemoryBufferManager(), 546 compositor->GetRendererSettings(), begin_frame_source.get(),
548 compositor->GetRendererSettings(), std::move(begin_frame_source),
549 std::move(display_output_surface), std::move(scheduler), 547 std::move(display_output_surface), std::move(scheduler),
550 base::MakeUnique<cc::TextureMailboxDeleter>( 548 base::MakeUnique<cc::TextureMailboxDeleter>(
551 compositor->task_runner().get())); 549 compositor->task_runner().get()));
552 550
551 // Initialize this after the display as the previous display had a reference
552 // to the previous BFS.
553 data->begin_frame_source = std::move(begin_frame_source);
554
553 // The |delegated_output_surface| is given back to the compositor, it 555 // The |delegated_output_surface| is given back to the compositor, it
554 // delegates to the Display as its root surface. Importantly, it shares the 556 // delegates to the Display as its root surface. Importantly, it shares the
555 // same ContextProvider as the Display's output surface. 557 // same ContextProvider as the Display's output surface.
556 std::unique_ptr<cc::SurfaceDisplayOutputSurface> delegated_output_surface( 558 std::unique_ptr<cc::SurfaceDisplayOutputSurface> delegated_output_surface(
557 vulkan_context_provider 559 vulkan_context_provider
558 ? new cc::SurfaceDisplayOutputSurface( 560 ? new cc::SurfaceDisplayOutputSurface(
559 surface_manager_.get(), compositor->surface_id_allocator(), 561 surface_manager_.get(), compositor->surface_id_allocator(),
560 data->display.get(), 562 data->display.get(),
561 static_cast<scoped_refptr<cc::VulkanContextProvider>>( 563 static_cast<scoped_refptr<cc::VulkanContextProvider>>(
562 vulkan_context_provider)) 564 vulkan_context_provider))
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 shared_vulkan_context_provider_ = 876 shared_vulkan_context_provider_ =
875 cc::VulkanInProcessContextProvider::Create(); 877 cc::VulkanInProcessContextProvider::Create();
876 } 878 }
877 879
878 shared_vulkan_context_provider_initialized_ = true; 880 shared_vulkan_context_provider_initialized_ = true;
879 } 881 }
880 return shared_vulkan_context_provider_; 882 return shared_vulkan_context_provider_;
881 } 883 }
882 884
883 } // namespace content 885 } // namespace content
OLDNEW
« no previous file with comments | « cc/test/test_delegating_output_surface.cc ('k') | content/browser/renderer_host/compositor_impl_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698