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

Side by Side Diff: ui/views/mus/surface_context_factory.cc

Issue 2559343003: mus: Rename GpuService to Gpu. (Closed)
Patch Set: . Created 4 years 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/views/mus/surface_context_factory.h ('k') | ui/views/mus/window_manager_connection.h » ('j') | 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/views/mus/surface_context_factory.h" 5 #include "ui/views/mus/surface_context_factory.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/resources/shared_bitmap_manager.h" 8 #include "cc/resources/shared_bitmap_manager.h"
9 #include "cc/surfaces/surface_id_allocator.h" 9 #include "cc/surfaces/surface_id_allocator.h"
10 #include "services/ui/public/cpp/context_provider.h" 10 #include "services/ui/public/cpp/context_provider.h"
11 #include "services/ui/public/cpp/gpu/gpu_service.h" 11 #include "services/ui/public/cpp/gpu/gpu.h"
12 #include "services/ui/public/cpp/window.h" 12 #include "services/ui/public/cpp/window.h"
13 #include "services/ui/public/cpp/window_compositor_frame_sink.h" 13 #include "services/ui/public/cpp/window_compositor_frame_sink.h"
14 #include "ui/compositor/reflector.h" 14 #include "ui/compositor/reflector.h"
15 #include "ui/gl/gl_bindings.h" 15 #include "ui/gl/gl_bindings.h"
16 #include "ui/views/mus/native_widget_mus.h" 16 #include "ui/views/mus/native_widget_mus.h"
17 17
18 namespace views { 18 namespace views {
19 namespace { 19 namespace {
20 20
21 class FakeReflector : public ui::Reflector { 21 class FakeReflector : public ui::Reflector {
22 public: 22 public:
23 FakeReflector() {} 23 FakeReflector() {}
24 ~FakeReflector() override {} 24 ~FakeReflector() override {}
25 void OnMirroringCompositorResized() override {} 25 void OnMirroringCompositorResized() override {}
26 void AddMirroringLayer(ui::Layer* layer) override {} 26 void AddMirroringLayer(ui::Layer* layer) override {}
27 void RemoveMirroringLayer(ui::Layer* layer) override {} 27 void RemoveMirroringLayer(ui::Layer* layer) override {}
28 }; 28 };
29 29
30 } // namespace 30 } // namespace
31 31
32 SurfaceContextFactory::SurfaceContextFactory(ui::GpuService* gpu_service) 32 SurfaceContextFactory::SurfaceContextFactory(ui::Gpu* gpu)
33 : next_sink_id_(1u), gpu_service_(gpu_service) {} 33 : next_sink_id_(1u), gpu_(gpu) {}
34 34
35 SurfaceContextFactory::~SurfaceContextFactory() {} 35 SurfaceContextFactory::~SurfaceContextFactory() {}
36 36
37 void SurfaceContextFactory::CreateCompositorFrameSink( 37 void SurfaceContextFactory::CreateCompositorFrameSink(
38 base::WeakPtr<ui::Compositor> compositor) { 38 base::WeakPtr<ui::Compositor> compositor) {
39 ui::Window* window = compositor->window(); 39 ui::Window* window = compositor->window();
40 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window); 40 NativeWidgetMus* native_widget = NativeWidgetMus::GetForWindow(window);
41 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type = 41 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type =
42 native_widget->compositor_frame_sink_type(); 42 native_widget->compositor_frame_sink_type();
43 auto compositor_frame_sink = window->RequestCompositorFrameSink( 43 auto compositor_frame_sink = window->RequestCompositorFrameSink(
44 compositor_frame_sink_type, make_scoped_refptr(new ui::ContextProvider( 44 compositor_frame_sink_type, make_scoped_refptr(new ui::ContextProvider(
45 gpu_service_->EstablishGpuChannelSync())), 45 gpu_->EstablishGpuChannelSync())),
46 gpu_service_->gpu_memory_buffer_manager()); 46 gpu_->gpu_memory_buffer_manager());
47 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); 47 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink));
48 } 48 }
49 49
50 std::unique_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector( 50 std::unique_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector(
51 ui::Compositor* mirroed_compositor, 51 ui::Compositor* mirroed_compositor,
52 ui::Layer* mirroring_layer) { 52 ui::Layer* mirroring_layer) {
53 // NOTIMPLEMENTED(); 53 // NOTIMPLEMENTED();
54 return base::WrapUnique(new FakeReflector); 54 return base::WrapUnique(new FakeReflector);
55 } 55 }
56 56
(...skipping 16 matching lines...) Expand all
73 } 73 }
74 74
75 uint32_t SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format, 75 uint32_t SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
76 gfx::BufferUsage usage) { 76 gfx::BufferUsage usage) {
77 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D. 77 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D.
78 return GL_TEXTURE_2D; 78 return GL_TEXTURE_2D;
79 } 79 }
80 80
81 gpu::GpuMemoryBufferManager* 81 gpu::GpuMemoryBufferManager*
82 SurfaceContextFactory::GetGpuMemoryBufferManager() { 82 SurfaceContextFactory::GetGpuMemoryBufferManager() {
83 return gpu_service_->gpu_memory_buffer_manager(); 83 return gpu_->gpu_memory_buffer_manager();
84 } 84 }
85 85
86 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() { 86 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() {
87 return raster_thread_helper_.task_graph_runner(); 87 return raster_thread_helper_.task_graph_runner();
88 } 88 }
89 89
90 cc::FrameSinkId SurfaceContextFactory::AllocateFrameSinkId() { 90 cc::FrameSinkId SurfaceContextFactory::AllocateFrameSinkId() {
91 return cc::FrameSinkId(0, next_sink_id_++); 91 return cc::FrameSinkId(0, next_sink_id_++);
92 } 92 }
93 93
94 cc::SurfaceManager* SurfaceContextFactory::GetSurfaceManager() { 94 cc::SurfaceManager* SurfaceContextFactory::GetSurfaceManager() {
95 return &surface_manager_; 95 return &surface_manager_;
96 } 96 }
97 97
98 void SurfaceContextFactory::SetDisplayVisible(ui::Compositor* compositor, 98 void SurfaceContextFactory::SetDisplayVisible(ui::Compositor* compositor,
99 bool visible) { 99 bool visible) {
100 // TODO(fsamuel): display[compositor]->SetVisible(visible); 100 // TODO(fsamuel): display[compositor]->SetVisible(visible);
101 } 101 }
102 102
103 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor, 103 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor,
104 const gfx::Size& size) { 104 const gfx::Size& size) {
105 // TODO(fsamuel): display[compositor]->Resize(size); 105 // TODO(fsamuel): display[compositor]->Resize(size);
106 } 106 }
107 107
108 } // namespace views 108 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/surface_context_factory.h ('k') | ui/views/mus/window_manager_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698