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

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

Issue 2429173005: Mus+Ash: Replace (Server)WindowSurface with (Server)WindowCompositorFrameSink (Closed)
Patch Set: Rebased Created 4 years, 2 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/views/mus/native_widget_mus_unittest.cc ('k') | ui/views/mus/window_manager_connection.cc » ('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/compositor_frame_sink.h"
11 #include "services/ui/public/cpp/context_provider.h" 10 #include "services/ui/public/cpp/context_provider.h"
12 #include "services/ui/public/cpp/gpu_service.h" 11 #include "services/ui/public/cpp/gpu_service.h"
13 #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"
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::GpuService* gpu_service)
33 : next_sink_id_(1u), gpu_service_(gpu_service) {} 33 : next_sink_id_(1u), gpu_service_(gpu_service) {}
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::SurfaceType surface_type = native_widget->surface_type(); 41 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type =
42 native_widget->compositor_frame_sink_type();
42 auto compositor_frame_sink = window->RequestCompositorFrameSink( 43 auto compositor_frame_sink = window->RequestCompositorFrameSink(
43 surface_type, make_scoped_refptr(new ui::ContextProvider( 44 compositor_frame_sink_type,
44 gpu_service_->EstablishGpuChannelSync()))); 45 make_scoped_refptr(
46 new ui::ContextProvider(gpu_service_->EstablishGpuChannelSync())));
45 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); 47 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink));
46 } 48 }
47 49
48 std::unique_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector( 50 std::unique_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector(
49 ui::Compositor* mirroed_compositor, 51 ui::Compositor* mirroed_compositor,
50 ui::Layer* mirroring_layer) { 52 ui::Layer* mirroring_layer) {
51 // NOTIMPLEMENTED(); 53 // NOTIMPLEMENTED();
52 return base::WrapUnique(new FakeReflector); 54 return base::WrapUnique(new FakeReflector);
53 } 55 }
54 56
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bool visible) { 104 bool visible) {
103 // TODO(fsamuel): display[compositor]->SetVisible(visible); 105 // TODO(fsamuel): display[compositor]->SetVisible(visible);
104 } 106 }
105 107
106 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor, 108 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor,
107 const gfx::Size& size) { 109 const gfx::Size& size) {
108 // TODO(fsamuel): display[compositor]->Resize(size); 110 // TODO(fsamuel): display[compositor]->Resize(size);
109 } 111 }
110 112
111 } // namespace views 113 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus_unittest.cc ('k') | ui/views/mus/window_manager_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698