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: services/ui/public/cpp/gpu/gpu.h

Issue 2586323002: mus: Use ui::ContextProviderCommandBuffer. (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 | « services/ui/public/cpp/gpu/command_buffer_metrics.cc ('k') | services/ui/public/cpp/gpu/gpu.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ 5 #ifndef SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_
6 #define SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ 6 #define SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "cc/output/context_provider.h"
16 #include "gpu/ipc/client/gpu_channel_host.h" 17 #include "gpu/ipc/client/gpu_channel_host.h"
17 #include "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h" 18 #include "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h"
18 #include "services/ui/public/interfaces/gpu.mojom.h" 19 #include "services/ui/public/interfaces/gpu.mojom.h"
19 20
20 namespace service_manager { 21 namespace service_manager {
21 class Connector; 22 class Connector;
22 class InterfaceProvider; 23 class InterfaceProvider;
23 } 24 }
24 25
25 namespace ui { 26 namespace ui {
(...skipping 10 matching lines...) Expand all
36 // The Gpu has to be initialized in the main thread before establishing 37 // The Gpu has to be initialized in the main thread before establishing
37 // the gpu channel. If no |task_runner| is provided, then a new thread is 38 // the gpu channel. If no |task_runner| is provided, then a new thread is
38 // created and used. 39 // created and used.
39 static std::unique_ptr<Gpu> Create( 40 static std::unique_ptr<Gpu> Create(
40 service_manager::Connector* connector, 41 service_manager::Connector* connector,
41 scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr); 42 scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr);
42 static std::unique_ptr<Gpu> Create( 43 static std::unique_ptr<Gpu> Create(
43 service_manager::InterfaceProvider*, 44 service_manager::InterfaceProvider*,
44 scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr); 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr);
45 46
47 scoped_refptr<cc::ContextProvider> CreateContextProvider(
48 scoped_refptr<gpu::GpuChannelHost> gpu_channel);
49
46 // gpu::GpuChannelEstablishFactory: 50 // gpu::GpuChannelEstablishFactory:
47 void EstablishGpuChannel( 51 void EstablishGpuChannel(
48 const gpu::GpuChannelEstablishedCallback& callback) override; 52 const gpu::GpuChannelEstablishedCallback& callback) override;
49 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override; 53 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override;
50 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; 54 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
51 55
52 private: 56 private:
53 friend struct base::DefaultSingletonTraits<Gpu>; 57 friend struct base::DefaultSingletonTraits<Gpu>;
54 58
55 Gpu(service_manager::Connector* connector, 59 Gpu(service_manager::Connector* connector,
56 service_manager::InterfaceProvider* provider, 60 service_manager::InterfaceProvider* provider,
57 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 61 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
58 62
59 scoped_refptr<gpu::GpuChannelHost> GetGpuChannel(); 63 scoped_refptr<gpu::GpuChannelHost> GetGpuChannel();
60 void EstablishGpuChannelOnMainThreadSyncLocked();
61 void OnEstablishedGpuChannel(int client_id, 64 void OnEstablishedGpuChannel(int client_id,
62 mojo::ScopedMessagePipeHandle channel_handle, 65 mojo::ScopedMessagePipeHandle channel_handle,
63 const gpu::GPUInfo& gpu_info); 66 const gpu::GPUInfo& gpu_info);
64 67
65 // gpu::GpuChannelHostFactory overrides: 68 // gpu::GpuChannelHostFactory overrides:
66 bool IsMainThread() override; 69 bool IsMainThread() override;
67 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; 70 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
68 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( 71 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
69 size_t size) override; 72 size_t size) override;
70 73
71 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 74 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
72 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 75 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
73 service_manager::Connector* connector_; 76 service_manager::Connector* connector_;
74 service_manager::InterfaceProvider* interface_provider_; 77 service_manager::InterfaceProvider* interface_provider_;
75 base::WaitableEvent shutdown_event_; 78 base::WaitableEvent shutdown_event_;
76 std::unique_ptr<base::Thread> io_thread_; 79 std::unique_ptr<base::Thread> io_thread_;
77 std::unique_ptr<ClientGpuMemoryBufferManager> gpu_memory_buffer_manager_; 80 std::unique_ptr<ClientGpuMemoryBufferManager> gpu_memory_buffer_manager_;
78 81
79 ui::mojom::GpuPtr gpu_; 82 ui::mojom::GpuPtr gpu_;
80 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; 83 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
81 std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_; 84 std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_;
82 85
83 DISALLOW_COPY_AND_ASSIGN(Gpu); 86 DISALLOW_COPY_AND_ASSIGN(Gpu);
84 }; 87 };
85 88
86 } // namespace ui 89 } // namespace ui
87 90
88 #endif // SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_ 91 #endif // SERVICES_UI_PUBLIC_CPP_GPU_GPU_H_
OLDNEW
« no previous file with comments | « services/ui/public/cpp/gpu/command_buffer_metrics.cc ('k') | services/ui/public/cpp/gpu/gpu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698