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

Side by Side Diff: gpu/ipc/service/gpu_channel_manager.h

Issue 1962493002: Make Mac swap code like other platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 4 years, 7 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 | « gpu/ipc/common/gpu_messages.h ('k') | gpu/ipc/service/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 GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ 5 #ifndef GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_
6 #define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ 6 #define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/containers/scoped_ptr_hash_map.h" 15 #include "base/containers/scoped_ptr_hash_map.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "gpu/command_buffer/common/constants.h" 20 #include "gpu/command_buffer/common/constants.h"
21 #include "gpu/config/gpu_driver_bug_workarounds.h" 21 #include "gpu/config/gpu_driver_bug_workarounds.h"
22 #include "gpu/gpu_export.h" 22 #include "gpu/gpu_export.h"
23 #include "gpu/ipc/service/gpu_memory_manager.h" 23 #include "gpu/ipc/service/gpu_memory_manager.h"
24 #include "ui/gfx/gpu_memory_buffer.h" 24 #include "ui/gfx/gpu_memory_buffer.h"
25 #include "ui/gfx/native_widget_types.h" 25 #include "ui/gfx/native_widget_types.h"
26 #include "ui/gl/gl_surface.h" 26 #include "ui/gl/gl_surface.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
28 28
29 #if defined(OS_MACOSX)
30 #include "base/callback.h"
31 #include "base/containers/hash_tables.h"
32 #include "gpu/ipc/common/surface_handle.h"
33 #endif
34
35 namespace base { 29 namespace base {
36 class WaitableEvent; 30 class WaitableEvent;
37 } 31 }
38 32
39 namespace gfx { 33 namespace gfx {
40 class GLShareGroup; 34 class GLShareGroup;
41 } 35 }
42 36
43 namespace gpu { 37 namespace gpu {
44 struct GpuPreferences; 38 struct GpuPreferences;
(...skipping 17 matching lines...) Expand all
62 class GpuChannel; 56 class GpuChannel;
63 class GpuChannelManagerDelegate; 57 class GpuChannelManagerDelegate;
64 class GpuMemoryBufferFactory; 58 class GpuMemoryBufferFactory;
65 class GpuWatchdog; 59 class GpuWatchdog;
66 60
67 // A GpuChannelManager is a thread responsible for issuing rendering commands 61 // A GpuChannelManager is a thread responsible for issuing rendering commands
68 // managing the lifetimes of GPU channels and forwarding IPC requests from the 62 // managing the lifetimes of GPU channels and forwarding IPC requests from the
69 // browser process to them based on the corresponding renderer ID. 63 // browser process to them based on the corresponding renderer ID.
70 class GPU_EXPORT GpuChannelManager { 64 class GPU_EXPORT GpuChannelManager {
71 public: 65 public:
72 #if defined(OS_MACOSX)
73 typedef base::Callback<
74 void(int32_t, const base::TimeTicks&, const base::TimeDelta&)>
75 BufferPresentedCallback;
76 #endif
77 GpuChannelManager(const GpuPreferences& gpu_preferences, 66 GpuChannelManager(const GpuPreferences& gpu_preferences,
78 GpuChannelManagerDelegate* delegate, 67 GpuChannelManagerDelegate* delegate,
79 GpuWatchdog* watchdog, 68 GpuWatchdog* watchdog,
80 base::SingleThreadTaskRunner* task_runner, 69 base::SingleThreadTaskRunner* task_runner,
81 base::SingleThreadTaskRunner* io_task_runner, 70 base::SingleThreadTaskRunner* io_task_runner,
82 base::WaitableEvent* shutdown_event, 71 base::WaitableEvent* shutdown_event,
83 SyncPointManager* sync_point_manager, 72 SyncPointManager* sync_point_manager,
84 GpuMemoryBufferFactory* gpu_memory_buffer_factory); 73 GpuMemoryBufferFactory* gpu_memory_buffer_factory);
85 virtual ~GpuChannelManager(); 74 virtual ~GpuChannelManager();
86 75
(...skipping 13 matching lines...) Expand all
100 void WakeUpGpu(); 89 void WakeUpGpu();
101 #endif 90 #endif
102 void DestroyAllChannels(); 91 void DestroyAllChannels();
103 92
104 // Remove the channel for a particular renderer. 93 // Remove the channel for a particular renderer.
105 void RemoveChannel(int client_id); 94 void RemoveChannel(int client_id);
106 95
107 void LoseAllContexts(); 96 void LoseAllContexts();
108 void MaybeExitOnContextLost(); 97 void MaybeExitOnContextLost();
109 98
110 #if defined(OS_MACOSX)
111 void AddBufferPresentedCallback(int32_t routing_id,
112 const BufferPresentedCallback& callback);
113 void RemoveBufferPresentedCallback(int32_t routing_id);
114 void BufferPresented(gpu::SurfaceHandle surface_handle,
115 const base::TimeTicks& vsync_timebase,
116 const base::TimeDelta& vsync_interval);
117 #endif
118
119 const GpuPreferences& gpu_preferences() const { 99 const GpuPreferences& gpu_preferences() const {
120 return gpu_preferences_; 100 return gpu_preferences_;
121 } 101 }
122 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds() const { 102 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds() const {
123 return gpu_driver_bug_workarounds_; 103 return gpu_driver_bug_workarounds_;
124 } 104 }
125 gles2::ProgramCache* program_cache(); 105 gles2::ProgramCache* program_cache();
126 gles2::ShaderTranslatorCache* shader_translator_cache(); 106 gles2::ShaderTranslatorCache* shader_translator_cache();
127 gles2::FramebufferCompletenessCache* framebuffer_completeness_cache(); 107 gles2::FramebufferCompletenessCache* framebuffer_completeness_cache();
128 108
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 int client_id); 166 int client_id);
187 #if defined(OS_ANDROID) 167 #if defined(OS_ANDROID)
188 void ScheduleWakeUpGpu(); 168 void ScheduleWakeUpGpu();
189 void DoWakeUpGpu(); 169 void DoWakeUpGpu();
190 #endif 170 #endif
191 171
192 const GpuPreferences& gpu_preferences_; 172 const GpuPreferences& gpu_preferences_;
193 GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; 173 GpuDriverBugWorkarounds gpu_driver_bug_workarounds_;
194 174
195 GpuChannelManagerDelegate* const delegate_; 175 GpuChannelManagerDelegate* const delegate_;
196 #if defined(OS_MACOSX)
197 base::hash_map<gpu::SurfaceHandle, BufferPresentedCallback>
198 buffer_presented_callback_map_;
199 #endif
200 176
201 GpuWatchdog* watchdog_; 177 GpuWatchdog* watchdog_;
202 178
203 base::WaitableEvent* shutdown_event_; 179 base::WaitableEvent* shutdown_event_;
204 180
205 scoped_refptr<gfx::GLShareGroup> share_group_; 181 scoped_refptr<gfx::GLShareGroup> share_group_;
206 scoped_refptr<gles2::MailboxManager> mailbox_manager_; 182 scoped_refptr<gles2::MailboxManager> mailbox_manager_;
207 scoped_refptr<PreemptionFlag> preemption_flag_; 183 scoped_refptr<PreemptionFlag> preemption_flag_;
208 GpuMemoryManager gpu_memory_manager_; 184 GpuMemoryManager gpu_memory_manager_;
209 // SyncPointManager guaranteed to outlive running MessageLoop. 185 // SyncPointManager guaranteed to outlive running MessageLoop.
(...skipping 19 matching lines...) Expand all
229 // that any WeakPtrs to Controller are invalidated before its members 205 // that any WeakPtrs to Controller are invalidated before its members
230 // variable's destructors are executed, rendering them invalid. 206 // variable's destructors are executed, rendering them invalid.
231 base::WeakPtrFactory<GpuChannelManager> weak_factory_; 207 base::WeakPtrFactory<GpuChannelManager> weak_factory_;
232 208
233 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); 209 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager);
234 }; 210 };
235 211
236 } // namespace gpu 212 } // namespace gpu
237 213
238 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_ 214 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/ipc/common/gpu_messages.h ('k') | gpu/ipc/service/gpu_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698