| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/core/compositor/blimp_compositor.h" | 5 #include "blimp/client/core/compositor/blimp_compositor.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // Try again if the context creation failed. | 182 // Try again if the context creation failed. |
| 183 if (!compositor_context_provider) { | 183 if (!compositor_context_provider) { |
| 184 GetEmbedderDeps()->GetContextProviders( | 184 GetEmbedderDeps()->GetContextProviders( |
| 185 base::Bind(&BlimpCompositor::OnContextProvidersCreated, | 185 base::Bind(&BlimpCompositor::OnContextProvidersCreated, |
| 186 weak_ptr_factory_.GetWeakPtr())); | 186 weak_ptr_factory_.GetWeakPtr())); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 | 189 |
| 190 auto compositor_frame_sink = base::MakeUnique<BlimpCompositorFrameSink>( | 190 auto compositor_frame_sink = base::MakeUnique<BlimpCompositorFrameSink>( |
| 191 std::move(compositor_context_provider), | 191 std::move(compositor_context_provider), |
| 192 std::move(worker_context_provider), base::ThreadTaskRunnerHandle::Get(), | 192 std::move(worker_context_provider), |
| 193 weak_ptr_factory_.GetWeakPtr()); | 193 GetEmbedderDeps()->GetGpuMemoryBufferManager(), nullptr, |
| 194 base::ThreadTaskRunnerHandle::Get(), weak_ptr_factory_.GetWeakPtr()); |
| 194 | 195 |
| 195 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 196 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
| 196 } | 197 } |
| 197 | 198 |
| 198 void BlimpCompositor::BindToProxyClient( | 199 void BlimpCompositor::BindToProxyClient( |
| 199 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) { | 200 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) { |
| 200 DCHECK(thread_checker_.CalledOnValidThread()); | 201 DCHECK(thread_checker_.CalledOnValidThread()); |
| 201 DCHECK(!surface_factory_); | 202 DCHECK(!surface_factory_); |
| 202 | 203 |
| 203 proxy_client_ = proxy_client; | 204 proxy_client_ = proxy_client; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 } | 287 } |
| 287 | 288 |
| 288 void BlimpCompositor::CreateLayerTreeHost() { | 289 void BlimpCompositor::CreateLayerTreeHost() { |
| 289 DCHECK(!host_); | 290 DCHECK(!host_); |
| 290 VLOG(1) << "Creating LayerTreeHost."; | 291 VLOG(1) << "Creating LayerTreeHost."; |
| 291 | 292 |
| 292 // Create the LayerTreeHost | 293 // Create the LayerTreeHost |
| 293 cc::LayerTreeHostInProcess::InitParams params; | 294 cc::LayerTreeHostInProcess::InitParams params; |
| 294 params.client = this; | 295 params.client = this; |
| 295 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); | 296 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); |
| 296 params.gpu_memory_buffer_manager = | |
| 297 GetEmbedderDeps()->GetGpuMemoryBufferManager(); | |
| 298 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 297 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 299 params.image_serialization_processor = | 298 params.image_serialization_processor = |
| 300 compositor_dependencies_->GetImageSerializationProcessor(); | 299 compositor_dependencies_->GetImageSerializationProcessor(); |
| 301 | 300 |
| 302 cc::LayerTreeSettings* settings = | 301 cc::LayerTreeSettings* settings = |
| 303 compositor_dependencies_->GetLayerTreeSettings(); | 302 compositor_dependencies_->GetLayerTreeSettings(); |
| 304 // TODO(khushalsagar): This is a hack. Remove when we move the split point | 303 // TODO(khushalsagar): This is a hack. Remove when we move the split point |
| 305 // out. For details on why this is needed, see crbug.com/586210. | 304 // out. For details on why this is needed, see crbug.com/586210. |
| 306 settings->abort_commit_before_compositor_frame_sink_creation = false; | 305 settings->abort_commit_before_compositor_frame_sink_creation = false; |
| 307 params.settings = settings; | 306 params.settings = settings; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 it->second.Run(); | 341 it->second.Run(); |
| 343 it = pending_commit_trackers_.erase(it); | 342 it = pending_commit_trackers_.erase(it); |
| 344 } else { | 343 } else { |
| 345 ++it; | 344 ++it; |
| 346 } | 345 } |
| 347 } | 346 } |
| 348 } | 347 } |
| 349 | 348 |
| 350 } // namespace client | 349 } // namespace client |
| 351 } // namespace blimp | 350 } // namespace blimp |
| OLD | NEW |