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

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

Issue 2329043002: services/ui: Avoid thread hopping in the gpu process. (Closed)
Patch Set: fix debug 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
59 // TODO(sad): These should be mojom API. 51 // TODO(sad): These should be mojom API.
60 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( 52 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
61 gfx::GpuMemoryBufferId id, 53 gfx::GpuMemoryBufferId id,
62 const gfx::Size& size, 54 const gfx::Size& size,
63 gfx::BufferFormat format, 55 gfx::BufferFormat format,
64 gfx::BufferUsage usage, 56 gfx::BufferUsage usage,
65 int client_id, 57 int client_id,
66 gpu::SurfaceHandle surface_handle); 58 gpu::SurfaceHandle surface_handle);
67 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 59 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
68 int client_id, 60 int client_id,
69 const gpu::SyncToken& sync_token); 61 const gpu::SyncToken& sync_token);
70 62
71 private: 63 private:
72 friend class GpuMain; 64 friend class GpuMain;
73 65
74 GpuServiceInternal(const gpu::GPUInfo& gpu_info, 66 GpuServiceInternal(const gpu::GPUInfo& gpu_info,
75 gpu::GpuWatchdogThread* watchdog, 67 gpu::GpuWatchdogThread* watchdog,
76 gpu::GpuMemoryBufferFactory* memory_buffer_factory); 68 gpu::GpuMemoryBufferFactory* memory_buffer_factory);
77 69
78 void EstablishGpuChannelInternal(int32_t client_id, 70 void BindOnGpuThread(mojom::GpuServiceInternalRequest request);
79 uint64_t client_tracing_id, 71
80 bool preempts,
81 bool allow_view_command_buffers,
82 bool allow_real_time_streams,
83 const EstablishGpuChannelCallback& callback);
84 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( 72 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle(
85 gfx::GpuMemoryBufferHandle buffer_handle, 73 gfx::GpuMemoryBufferHandle buffer_handle,
86 gfx::GpuMemoryBufferId id, 74 gfx::GpuMemoryBufferId id,
87 const gfx::Size& size, 75 const gfx::Size& size,
88 gfx::BufferFormat format, 76 gfx::BufferFormat format,
89 int client_id); 77 int client_id);
90 78
91 // gpu::GpuChannelManagerDelegate: 79 // gpu::GpuChannelManagerDelegate:
92 void DidCreateOffscreenContext(const GURL& active_url) override; 80 void DidCreateOffscreenContext(const GURL& active_url) override;
93 void DidDestroyChannel(int client_id) override; 81 void DidDestroyChannel(int client_id) override;
(...skipping 12 matching lines...) Expand all
106 void SetActiveURL(const GURL& url) override; 94 void SetActiveURL(const GURL& url) override;
107 95
108 // mojom::GpuServiceInternal: 96 // mojom::GpuServiceInternal:
109 void Initialize(const InitializeCallback& callback) override; 97 void Initialize(const InitializeCallback& callback) override;
110 void EstablishGpuChannel( 98 void EstablishGpuChannel(
111 int32_t client_id, 99 int32_t client_id,
112 uint64_t client_tracing_id, 100 uint64_t client_tracing_id,
113 bool is_gpu_host, 101 bool is_gpu_host,
114 const EstablishGpuChannelCallback& callback) override; 102 const EstablishGpuChannelCallback& callback) override;
115 103
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
125 // The main thread task runner. 104 // The main thread task runner.
126 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 105 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
127 106
128 // An event that will be signalled when we shutdown. 107 // An event that will be signalled when we shutdown.
129 base::WaitableEvent shutdown_event_; 108 base::WaitableEvent shutdown_event_;
130 109
131 // The main thread for GpuService. 110 // The main thread for GpuService.
132 base::Thread gpu_thread_; 111 base::Thread gpu_thread_;
133 112
134 // The thread that handles IO events for GpuService. 113 // The thread that handles IO events for GpuService.
(...skipping 15 matching lines...) Expand all
150 gpu::GPUInfo gpu_info_; 129 gpu::GPUInfo gpu_info_;
151 130
152 mojo::Binding<mojom::GpuServiceInternal> binding_; 131 mojo::Binding<mojom::GpuServiceInternal> binding_;
153 132
154 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); 133 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal);
155 }; 134 };
156 135
157 } // namespace ui 136 } // namespace ui
158 137
159 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ 138 #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