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

Side by Side Diff: services/ui/gpu/gpu_service_internal.h

Issue 2339653002: Revert of services/ui: Avoid thread hopping in the gpu process. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | services/ui/gpu/gpu_service_internal.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_GPU_GPU_SERVICE_INTERNAL_H_ 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ 6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
(...skipping 30 matching lines...) Expand all
41 // the window server) over the mojom APIs. This is responsible for setting up 41 // the window server) over the mojom APIs. This is responsible for setting up
42 // the connection to clients, allocating/free'ing gpu memory etc. 42 // the connection to clients, allocating/free'ing gpu memory etc.
43 class GpuServiceInternal : public gpu::GpuChannelManagerDelegate, 43 class GpuServiceInternal : public gpu::GpuChannelManagerDelegate,
44 public mojom::GpuServiceInternal, 44 public mojom::GpuServiceInternal,
45 public base::NonThreadSafe { 45 public base::NonThreadSafe {
46 public: 46 public:
47 ~GpuServiceInternal() override; 47 ~GpuServiceInternal() override;
48 48
49 void Add(mojom::GpuServiceInternalRequest request); 49 void Add(mojom::GpuServiceInternalRequest request);
50 50
51 gpu::GpuChannelManager* gpu_channel_manager() const {
52 return gpu_channel_manager_.get();
53 }
54
55 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory() const {
56 return gpu_memory_buffer_factory_;
57 }
58
51 // TODO(sad): These should be mojom API. 59 // TODO(sad): These should be mojom API.
52 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( 60 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
53 gfx::GpuMemoryBufferId id, 61 gfx::GpuMemoryBufferId id,
54 const gfx::Size& size, 62 const gfx::Size& size,
55 gfx::BufferFormat format, 63 gfx::BufferFormat format,
56 gfx::BufferUsage usage, 64 gfx::BufferUsage usage,
57 int client_id, 65 int client_id,
58 gpu::SurfaceHandle surface_handle); 66 gpu::SurfaceHandle surface_handle);
59 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 67 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
60 int client_id, 68 int client_id,
61 const gpu::SyncToken& sync_token); 69 const gpu::SyncToken& sync_token);
62 70
63 private: 71 private:
64 friend class GpuMain; 72 friend class GpuMain;
65 73
66 GpuServiceInternal(const gpu::GPUInfo& gpu_info, 74 GpuServiceInternal(const gpu::GPUInfo& gpu_info,
67 gpu::GpuWatchdogThread* watchdog, 75 gpu::GpuWatchdogThread* watchdog,
68 gpu::GpuMemoryBufferFactory* memory_buffer_factory); 76 gpu::GpuMemoryBufferFactory* memory_buffer_factory);
69 77
70 void BindOnGpuThread(mojom::GpuServiceInternalRequest request); 78 void EstablishGpuChannelInternal(int32_t client_id,
71 79 uint64_t client_tracing_id,
80 bool preempts,
81 bool allow_view_command_buffers,
82 bool allow_real_time_streams,
83 const EstablishGpuChannelCallback& callback);
72 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( 84 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle(
73 gfx::GpuMemoryBufferHandle buffer_handle, 85 gfx::GpuMemoryBufferHandle buffer_handle,
74 gfx::GpuMemoryBufferId id, 86 gfx::GpuMemoryBufferId id,
75 const gfx::Size& size, 87 const gfx::Size& size,
76 gfx::BufferFormat format, 88 gfx::BufferFormat format,
77 int client_id); 89 int client_id);
78 90
79 // gpu::GpuChannelManagerDelegate: 91 // gpu::GpuChannelManagerDelegate:
80 void DidCreateOffscreenContext(const GURL& active_url) override; 92 void DidCreateOffscreenContext(const GURL& active_url) override;
81 void DidDestroyChannel(int client_id) override; 93 void DidDestroyChannel(int client_id) override;
(...skipping 12 matching lines...) Expand all
94 void SetActiveURL(const GURL& url) override; 106 void SetActiveURL(const GURL& url) override;
95 107
96 // mojom::GpuServiceInternal: 108 // mojom::GpuServiceInternal:
97 void Initialize(const InitializeCallback& callback) override; 109 void Initialize(const InitializeCallback& callback) override;
98 void EstablishGpuChannel( 110 void EstablishGpuChannel(
99 int32_t client_id, 111 int32_t client_id,
100 uint64_t client_tracing_id, 112 uint64_t client_tracing_id,
101 bool is_gpu_host, 113 bool is_gpu_host,
102 const EstablishGpuChannelCallback& callback) override; 114 const EstablishGpuChannelCallback& callback) override;
103 115
116 void InitializeOnGpuThread(base::WaitableEvent* event);
117 void EstablishGpuChannelOnGpuThread(
118 int client_id,
119 uint64_t client_tracing_id,
120 bool preempts,
121 bool allow_view_command_buffers,
122 bool allow_real_time_streams,
123 mojo::ScopedMessagePipeHandle* channel_handle);
124
104 // The main thread task runner. 125 // The main thread task runner.
105 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 126 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
106 127
107 // An event that will be signalled when we shutdown. 128 // An event that will be signalled when we shutdown.
108 base::WaitableEvent shutdown_event_; 129 base::WaitableEvent shutdown_event_;
109 130
110 // The main thread for GpuService. 131 // The main thread for GpuService.
111 base::Thread gpu_thread_; 132 base::Thread gpu_thread_;
112 133
113 // The thread that handles IO events for GpuService. 134 // The thread that handles IO events for GpuService.
(...skipping 15 matching lines...) Expand all
129 gpu::GPUInfo gpu_info_; 150 gpu::GPUInfo gpu_info_;
130 151
131 mojo::Binding<mojom::GpuServiceInternal> binding_; 152 mojo::Binding<mojom::GpuServiceInternal> binding_;
132 153
133 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); 154 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal);
134 }; 155 };
135 156
136 } // namespace ui 157 } // namespace ui
137 158
138 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ 159 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/gpu/gpu_service_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698