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

Side by Side Diff: ui/aura/mus/mus_context_factory.cc

Issue 2890453002: Implement MusContextFactory::SharedMainThreadContextProvider() (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « ui/aura/mus/mus_context_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/aura/mus/mus_context_factory.h" 5 #include "ui/aura/mus/mus_context_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/base/switches.h" 9 #include "cc/base/switches.h"
10 #include "services/ui/public/cpp/gpu/gpu.h" 10 #include "services/ui/public/cpp/gpu/gpu.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 void MusContextFactory::CreateCompositorFrameSink( 56 void MusContextFactory::CreateCompositorFrameSink(
57 base::WeakPtr<ui::Compositor> compositor) { 57 base::WeakPtr<ui::Compositor> compositor) {
58 gpu_->EstablishGpuChannel( 58 gpu_->EstablishGpuChannel(
59 base::Bind(&MusContextFactory::OnEstablishedGpuChannel, 59 base::Bind(&MusContextFactory::OnEstablishedGpuChannel,
60 weak_ptr_factory_.GetWeakPtr(), compositor)); 60 weak_ptr_factory_.GetWeakPtr(), compositor));
61 } 61 }
62 62
63 scoped_refptr<cc::ContextProvider> 63 scoped_refptr<cc::ContextProvider>
64 MusContextFactory::SharedMainThreadContextProvider() { 64 MusContextFactory::SharedMainThreadContextProvider() {
65 // NOTIMPLEMENTED(); 65 if (!shared_main_thread_context_provider_) {
66 return nullptr; 66 // In this point, the gpu channel should be already established in gpu_,
67 // the gpu_->EstablishGpuChannelSync() just returns the gpu channel
68 // immediately.
sadrul 2017/05/16 19:34:27 Can you verify that here? i.e. have a bool flag th
Peng 2017/05/16 19:52:08 I think we shouldn't DCHECK it, because ui::Contex
sadrul 2017/05/16 19:53:27 If we cannot depend on this, can you remove/update
Peng 2017/05/16 19:56:55 Removed. Done
69 scoped_refptr<gpu::GpuChannelHost> gpu_channel =
70 gpu_->EstablishGpuChannelSync();
71 shared_main_thread_context_provider_ =
72 gpu_->CreateContextProvider(std::move(gpu_channel));
73 if (!shared_main_thread_context_provider_->BindToCurrentThread())
74 shared_main_thread_context_provider_ = nullptr;
75 }
76 return shared_main_thread_context_provider_;
67 } 77 }
68 78
69 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) { 79 void MusContextFactory::RemoveCompositor(ui::Compositor* compositor) {
70 // NOTIMPLEMENTED(); 80 // NOTIMPLEMENTED();
71 } 81 }
72 82
73 double MusContextFactory::GetRefreshRate() const { 83 double MusContextFactory::GetRefreshRate() const {
74 return 60.0; 84 return 60.0;
75 } 85 }
76 86
77 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() { 87 gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() {
78 return gpu_->gpu_memory_buffer_manager(); 88 return gpu_->gpu_memory_buffer_manager();
79 } 89 }
80 90
81 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { 91 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
82 return raster_thread_helper_.task_graph_runner(); 92 return raster_thread_helper_.task_graph_runner();
83 } 93 }
84 94
85 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const { 95 const cc::RendererSettings& MusContextFactory::GetRendererSettings() const {
86 return renderer_settings_; 96 return renderer_settings_;
87 } 97 }
88 98
89 } // namespace aura 99 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/mus_context_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698