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

Side by Side Diff: content/common/gpu/gpu_channel_manager.h

Issue 1365563002: Make channel preemption not require view contexts for hookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wakeup_gpu
Patch Set: rebase Created 5 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 | « content/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_channel_manager.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 26
27 namespace base { 27 namespace base {
28 class WaitableEvent; 28 class WaitableEvent;
29 } 29 }
30 30
31 namespace gfx { 31 namespace gfx {
32 class GLShareGroup; 32 class GLShareGroup;
33 } 33 }
34 34
35 namespace gpu { 35 namespace gpu {
36 class PreemptionFlag;
36 class SyncPointManager; 37 class SyncPointManager;
37 union ValueState; 38 union ValueState;
38 namespace gles2 { 39 namespace gles2 {
39 class FramebufferCompletenessCache; 40 class FramebufferCompletenessCache;
40 class MailboxManager; 41 class MailboxManager;
41 class ProgramCache; 42 class ProgramCache;
42 class ShaderTranslatorCache; 43 class ShaderTranslatorCache;
43 } 44 }
44 } 45 }
45 46
46 namespace IPC { 47 namespace IPC {
47 struct ChannelHandle; 48 struct ChannelHandle;
48 class SyncChannel; 49 class SyncChannel;
49 } 50 }
50 51
51 struct GPUCreateCommandBufferConfig; 52 struct GPUCreateCommandBufferConfig;
53 struct GpuMsg_EstablishChannel_Params;
52 54
53 namespace content { 55 namespace content {
54 class GpuChannel; 56 class GpuChannel;
55 class GpuMemoryBufferFactory; 57 class GpuMemoryBufferFactory;
56 class GpuWatchdog; 58 class GpuWatchdog;
57 59
58 // A GpuChannelManager is a thread responsible for issuing rendering commands 60 // A GpuChannelManager is a thread responsible for issuing rendering commands
59 // managing the lifetimes of GPU channels and forwarding IPC requests from the 61 // managing the lifetimes of GPU channels and forwarding IPC requests from the
60 // browser process to them based on the corresponding renderer ID. 62 // browser process to them based on the corresponding renderer ID.
61 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, 63 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 111
110 // Returns the maximum order number for processed IPC messages across all 112 // Returns the maximum order number for processed IPC messages across all
111 // channels. 113 // channels.
112 uint32_t GetProcessedOrderNum() const; 114 uint32_t GetProcessedOrderNum() const;
113 115
114 #if defined(OS_ANDROID) 116 #if defined(OS_ANDROID)
115 void DidAccessGpu(); 117 void DidAccessGpu();
116 #endif 118 #endif
117 119
118 protected: 120 protected:
119 virtual scoped_ptr<GpuChannel> CreateGpuChannel( 121 virtual scoped_ptr<GpuChannel> CreateGpuChannel(int client_id,
120 gfx::GLShareGroup* share_group, 122 uint64_t client_tracing_id,
121 gpu::gles2::MailboxManager* mailbox_manager, 123 bool preempts,
122 int client_id, 124 bool allow_future_sync_points,
123 uint64_t client_tracing_id, 125 bool allow_real_time_streams);
124 bool allow_future_sync_points, 126
125 bool allow_real_time_streams); 127 gfx::GLShareGroup* share_group() const { return share_group_.get(); }
128 gpu::gles2::MailboxManager* mailbox_manager() const {
129 return mailbox_manager_.get();
130 }
131 gpu::PreemptionFlag* preemption_flag() const {
132 return preemption_flag_.get();
133 }
126 134
127 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 135 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
128 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 136 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
129 137
130 // These objects manage channels to individual renderer processes there is 138 // These objects manage channels to individual renderer processes there is
131 // one channel for each renderer process that has connected to this GPU 139 // one channel for each renderer process that has connected to this GPU
132 // process. 140 // process.
133 base::ScopedPtrHashMap<int32, scoped_ptr<GpuChannel>> gpu_channels_; 141 base::ScopedPtrHashMap<int32, scoped_ptr<GpuChannel>> gpu_channels_;
134 142
135 private: 143 private:
136 // Message handlers. 144 // Message handlers.
137 bool OnControlMessageReceived(const IPC::Message& msg); 145 bool OnControlMessageReceived(const IPC::Message& msg);
138 void OnEstablishChannel(int client_id, 146 void OnEstablishChannel(const GpuMsg_EstablishChannel_Params& params);
139 uint64_t client_tracing_id,
140 bool share_context,
141 bool allow_future_sync_points,
142 bool allow_real_time_streams);
143 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); 147 void OnCloseChannel(const IPC::ChannelHandle& channel_handle);
144 void OnVisibilityChanged( 148 void OnVisibilityChanged(int32 render_view_id, int32 client_id, bool visible);
145 int32 render_view_id, int32 client_id, bool visible);
146 void OnCreateViewCommandBuffer( 149 void OnCreateViewCommandBuffer(
147 const gfx::GLSurfaceHandle& window, 150 const gfx::GLSurfaceHandle& window,
148 int32 render_view_id,
149 int32 client_id, 151 int32 client_id,
150 const GPUCreateCommandBufferConfig& init_params, 152 const GPUCreateCommandBufferConfig& init_params,
151 int32 route_id); 153 int32 route_id);
152 void OnLoadedShader(std::string shader); 154 void OnLoadedShader(std::string shader);
153 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); 155 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id);
154 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id); 156 void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id);
155 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 157 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
156 int client_id, 158 int client_id,
157 int32 sync_point); 159 int32 sync_point);
158 160
(...skipping 10 matching lines...) Expand all
169 // Used to send and receive IPC messages from the browser process. 171 // Used to send and receive IPC messages from the browser process.
170 IPC::SyncChannel* const channel_; 172 IPC::SyncChannel* const channel_;
171 MessageRouter router_; 173 MessageRouter router_;
172 174
173 GpuWatchdog* watchdog_; 175 GpuWatchdog* watchdog_;
174 176
175 base::WaitableEvent* shutdown_event_; 177 base::WaitableEvent* shutdown_event_;
176 178
177 scoped_refptr<gfx::GLShareGroup> share_group_; 179 scoped_refptr<gfx::GLShareGroup> share_group_;
178 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 180 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
181 scoped_refptr<gpu::PreemptionFlag> preemption_flag_;
179 GpuMemoryManager gpu_memory_manager_; 182 GpuMemoryManager gpu_memory_manager_;
180 // SyncPointManager guaranteed to outlive running MessageLoop. 183 // SyncPointManager guaranteed to outlive running MessageLoop.
181 gpu::SyncPointManager* sync_point_manager_; 184 gpu::SyncPointManager* sync_point_manager_;
182 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; 185 scoped_ptr<gpu::gles2::ProgramCache> program_cache_;
183 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 186 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
184 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> 187 scoped_refptr<gpu::gles2::FramebufferCompletenessCache>
185 framebuffer_completeness_cache_; 188 framebuffer_completeness_cache_;
186 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; 189 scoped_refptr<gfx::GLSurface> default_offscreen_surface_;
187 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; 190 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_;
188 #if defined(OS_ANDROID) 191 #if defined(OS_ANDROID)
189 // Last time we know the GPU was powered on. Global for tracking across all 192 // Last time we know the GPU was powered on. Global for tracking across all
190 // transport surfaces. 193 // transport surfaces.
191 base::TimeTicks last_gpu_access_time_; 194 base::TimeTicks last_gpu_access_time_;
192 base::TimeTicks begin_wake_up_time_; 195 base::TimeTicks begin_wake_up_time_;
193 #endif 196 #endif
194 197
195 // Member variables should appear before the WeakPtrFactory, to ensure 198 // Member variables should appear before the WeakPtrFactory, to ensure
196 // that any WeakPtrs to Controller are invalidated before its members 199 // that any WeakPtrs to Controller are invalidated before its members
197 // variable's destructors are executed, rendering them invalid. 200 // variable's destructors are executed, rendering them invalid.
198 base::WeakPtrFactory<GpuChannelManager> weak_factory_; 201 base::WeakPtrFactory<GpuChannelManager> weak_factory_;
199 202
200 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); 203 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager);
201 }; 204 };
202 205
203 } // namespace content 206 } // namespace content
204 207
205 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 208 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698