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

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

Issue 1210703002: content: Make sure all CreateGpuMemoryBuffer messages are handled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid use of g_thread_safe_sender Created 5 years, 6 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 | 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 11 matching lines...) Expand all
22 #include "ui/gfx/gpu_memory_buffer.h" 22 #include "ui/gfx/gpu_memory_buffer.h"
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gl/gl_surface.h" 24 #include "ui/gl/gl_surface.h"
25 25
26 namespace base { 26 namespace base {
27 class WaitableEvent; 27 class WaitableEvent;
28 } 28 }
29 29
30 namespace gfx { 30 namespace gfx {
31 class GLShareGroup; 31 class GLShareGroup;
32 struct GpuMemoryBufferHandle;
33 } 32 }
34 33
35 namespace gpu { 34 namespace gpu {
36 class SyncPointManager; 35 class SyncPointManager;
37 union ValueState; 36 union ValueState;
38 namespace gles2 { 37 namespace gles2 {
39 class MailboxManager; 38 class MailboxManager;
40 class ProgramCache; 39 class ProgramCache;
41 class ShaderTranslatorCache; 40 class ShaderTranslatorCache;
42 } 41 }
43 } 42 }
44 43
45 namespace IPC { 44 namespace IPC {
46 class AttachmentBroker; 45 class AttachmentBroker;
47 struct ChannelHandle; 46 struct ChannelHandle;
48 class SyncChannel; 47 class SyncChannel;
49 class MessageFilter;
50 } 48 }
51 49
52 struct GPUCreateCommandBufferConfig; 50 struct GPUCreateCommandBufferConfig;
53 51
54 namespace content { 52 namespace content {
55 class GpuChannel; 53 class GpuChannel;
56 class GpuMemoryBufferFactory; 54 class GpuMemoryBufferFactory;
57 class GpuWatchdog; 55 class GpuWatchdog;
58 class MessageRouter; 56 class MessageRouter;
59 57
60 // A GpuChannelManager is a thread responsible for issuing rendering commands 58 // A GpuChannelManager is a thread responsible for issuing rendering commands
61 // managing the lifetimes of GPU channels and forwarding IPC requests from the 59 // managing the lifetimes of GPU channels and forwarding IPC requests from the
62 // browser process to them based on the corresponding renderer ID. 60 // browser process to them based on the corresponding renderer ID.
63 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, 61 class CONTENT_EXPORT GpuChannelManager : public IPC::Listener,
64 public IPC::Sender { 62 public IPC::Sender {
65 public: 63 public:
66 // |broker| must outlive GpuChannelManager and any channels it creates. 64 // |broker| must outlive GpuChannelManager and any channels it creates.
67 GpuChannelManager(MessageRouter* router, 65 GpuChannelManager(MessageRouter* router,
68 GpuWatchdog* watchdog, 66 GpuWatchdog* watchdog,
69 base::SingleThreadTaskRunner* io_task_runner, 67 base::SingleThreadTaskRunner* io_task_runner,
70 base::WaitableEvent* shutdown_event, 68 base::WaitableEvent* shutdown_event,
71 IPC::SyncChannel* channel, 69 IPC::SyncChannel* channel,
72 IPC::AttachmentBroker* broker); 70 IPC::AttachmentBroker* broker,
71 GpuMemoryBufferFactory* gpu_memory_buffer_factory);
73 ~GpuChannelManager() override; 72 ~GpuChannelManager() override;
74 73
75 // Remove the channel for a particular renderer. 74 // Remove the channel for a particular renderer.
76 void RemoveChannel(int client_id); 75 void RemoveChannel(int client_id);
77 76
78 // Listener overrides. 77 // Listener overrides.
79 bool OnMessageReceived(const IPC::Message& msg) override; 78 bool OnMessageReceived(const IPC::Message& msg) override;
80 79
81 // Sender overrides. 80 // Sender overrides.
82 bool Send(IPC::Message* msg) override; 81 bool Send(IPC::Message* msg) override;
(...skipping 14 matching lines...) Expand all
97 96
98 GpuChannel* LookupChannel(int32 client_id); 97 GpuChannel* LookupChannel(int32 client_id);
99 98
100 gpu::SyncPointManager* sync_point_manager() { 99 gpu::SyncPointManager* sync_point_manager() {
101 return sync_point_manager_.get(); 100 return sync_point_manager_.get();
102 } 101 }
103 102
104 gfx::GLSurface* GetDefaultOffscreenSurface(); 103 gfx::GLSurface* GetDefaultOffscreenSurface();
105 104
106 GpuMemoryBufferFactory* gpu_memory_buffer_factory() { 105 GpuMemoryBufferFactory* gpu_memory_buffer_factory() {
107 return gpu_memory_buffer_factory_.get(); 106 return gpu_memory_buffer_factory_;
108 } 107 }
109 108
110 private: 109 private:
111 typedef base::ScopedPtrHashMap<int, scoped_ptr<GpuChannel>> GpuChannelMap; 110 typedef base::ScopedPtrHashMap<int, scoped_ptr<GpuChannel>> GpuChannelMap;
112 111
113 // Message handlers. 112 // Message handlers.
114 void OnEstablishChannel(int client_id, 113 void OnEstablishChannel(int client_id,
115 bool share_context, 114 bool share_context,
116 bool allow_future_sync_points); 115 bool allow_future_sync_points);
117 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); 116 void OnCloseChannel(const IPC::ChannelHandle& channel_handle);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // process. 150 // process.
152 GpuChannelMap gpu_channels_; 151 GpuChannelMap gpu_channels_;
153 scoped_refptr<gfx::GLShareGroup> share_group_; 152 scoped_refptr<gfx::GLShareGroup> share_group_;
154 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 153 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
155 GpuMemoryManager gpu_memory_manager_; 154 GpuMemoryManager gpu_memory_manager_;
156 GpuWatchdog* watchdog_; 155 GpuWatchdog* watchdog_;
157 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; 156 scoped_refptr<gpu::SyncPointManager> sync_point_manager_;
158 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; 157 scoped_ptr<gpu::gles2::ProgramCache> program_cache_;
159 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 158 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
160 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; 159 scoped_refptr<gfx::GLSurface> default_offscreen_surface_;
161 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; 160 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_;
162 IPC::SyncChannel* channel_; 161 IPC::SyncChannel* channel_;
163 scoped_refptr<IPC::MessageFilter> filter_;
164 bool relinquish_resources_pending_; 162 bool relinquish_resources_pending_;
165 // Must outlive this instance of GpuChannelManager. 163 // Must outlive this instance of GpuChannelManager.
166 IPC::AttachmentBroker* attachment_broker_; 164 IPC::AttachmentBroker* attachment_broker_;
167 165
168 // Member variables should appear before the WeakPtrFactory, to ensure 166 // Member variables should appear before the WeakPtrFactory, to ensure
169 // that any WeakPtrs to Controller are invalidated before its members 167 // that any WeakPtrs to Controller are invalidated before its members
170 // variable's destructors are executed, rendering them invalid. 168 // variable's destructors are executed, rendering them invalid.
171 base::WeakPtrFactory<GpuChannelManager> weak_factory_; 169 base::WeakPtrFactory<GpuChannelManager> weak_factory_;
172 170
173 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); 171 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager);
174 }; 172 };
175 173
176 } // namespace content 174 } // namespace content
177 175
178 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 176 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/gpu_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698