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

Side by Side Diff: blimp/client/feature/compositor/blimp_compositor.cc

Issue 2242653002: blimp: Make Blimp client use a Display for compositing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: blimpdisplay: . Created 4 years, 4 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 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/feature/compositor/blimp_compositor.h" 5 #include "blimp/client/feature/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/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/threading/thread_local.h" 13 #include "base/threading/thread_local.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "blimp/client/feature/compositor/blimp_context_provider.h" 16 #include "blimp/client/feature/compositor/blimp_context_provider.h"
17 #include "blimp/client/feature/compositor/blimp_delegating_output_surface.h"
17 #include "blimp/client/feature/compositor/blimp_output_surface.h" 18 #include "blimp/client/feature/compositor/blimp_output_surface.h"
18 #include "cc/animation/animation_host.h" 19 #include "cc/animation/animation_host.h"
19 #include "cc/layers/layer.h" 20 #include "cc/layers/layer.h"
20 #include "cc/output/output_surface.h" 21 #include "cc/output/output_surface.h"
21 #include "cc/proto/compositor_message.pb.h" 22 #include "cc/proto/compositor_message.pb.h"
22 #include "cc/trees/layer_tree_host.h" 23 #include "cc/trees/layer_tree_host.h"
23 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
24 #include "ui/gl/gl_surface.h" 25 #include "ui/gl/gl_surface.h"
25 26
26 namespace blimp { 27 namespace blimp {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 249
249 void BlimpCompositor::HandlePendingOutputSurfaceRequest() { 250 void BlimpCompositor::HandlePendingOutputSurfaceRequest() {
250 DCHECK(output_surface_request_pending_); 251 DCHECK(output_surface_request_pending_);
251 252
252 // We might have had a request from a LayerTreeHost that was then 253 // We might have had a request from a LayerTreeHost that was then
253 // hidden (and hidden means we don't have a native surface). 254 // hidden (and hidden means we don't have a native surface).
254 // Also make sure we only handle this once. 255 // Also make sure we only handle this once.
255 if (!host_->visible() || window_ == gfx::kNullAcceleratedWidget) 256 if (!host_->visible() || window_ == gfx::kNullAcceleratedWidget)
256 return; 257 return;
257 258
258 scoped_refptr<BlimpContextProvider> context_provider = 259 scoped_refptr<BlimpContextProvider> display_context_provider =
259 BlimpContextProvider::Create(window_, 260 BlimpContextProvider::Create(window_,
260 client_->GetGpuMemoryBufferManager()); 261 client_->GetGpuMemoryBufferManager());
262 scoped_refptr<BlimpContextProvider> compositor_context_provider =
263 BlimpContextProvider::Create(gfx::kNullAcceleratedWidget,
264 client_->GetGpuMemoryBufferManager());
265 scoped_refptr<BlimpContextProvider> worker_context_provider = nullptr;
Wez 2016/08/12 01:56:49 nit: No need for = nullptr here.
266 // TODO(khushalsagar): Make a worker context and bind it to the current
267 // thread:
268 // Worker context is bound to the main thread in RenderThreadImpl. One day
269 // that will change and then this will have to be removed.
270 // worker_context_provider->BindToCurrentThread();
Wez 2016/08/12 01:56:49 This is commented out; what is it that will one da
danakj 2016/08/12 18:16:53 When the context isn't null, this will have to be
261 271
262 host_->SetOutputSurface( 272 auto display_output_surface =
263 base::WrapUnique(new BlimpOutputSurface(context_provider))); 273 base::MakeUnique<BlimpOutputSurface>(std::move(display_context_provider));
274 auto delegating_output_surface =
275 base::MakeUnique<BlimpDelegatingOutputSurface>(
276 std::move(compositor_context_provider),
277 std::move(worker_context_provider), std::move(display_output_surface),
278 client_->GetGpuMemoryBufferManager(),
279 host_->settings().renderer_settings,
280 client_->GetCompositorTaskRunner().get());
281
282 host_->SetOutputSurface(std::move(delegating_output_surface));
264 output_surface_request_pending_ = false; 283 output_surface_request_pending_ = false;
265 } 284 }
266 285
267 } // namespace client 286 } // namespace client
268 } // namespace blimp 287 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698