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

Side by Side Diff: content/common/gpu/client/command_buffer_proxy_impl.h

Issue 10852009: Clarify ownership of GpuVideoDecodeAcceleratorHost and avoid crash on context loss. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/common/gpu/client/command_buffer_proxy_impl.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_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
7 7
8 #if defined(ENABLE_GPU) 8 #if defined(ENABLE_GPU)
9 9
10 #include <map> 10 #include <map>
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // TODO(apatrick): this is a temporary optimization while skia is calling 100 // TODO(apatrick): this is a temporary optimization while skia is calling
101 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 101 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6
102 // ints redundantly when only the error is needed for the 102 // ints redundantly when only the error is needed for the
103 // CommandBufferProxyImpl implementation. 103 // CommandBufferProxyImpl implementation.
104 virtual gpu::error::Error GetLastError() OVERRIDE; 104 virtual gpu::error::Error GetLastError() OVERRIDE;
105 105
106 GpuChannelHost* channel() const { return channel_; } 106 GpuChannelHost* channel() const { return channel_; }
107 107
108 private: 108 private:
109 typedef std::map<int32, gpu::Buffer> TransferBufferMap; 109 typedef std::map<int32, gpu::Buffer> TransferBufferMap;
110 typedef std::map<int, GpuVideoDecodeAcceleratorHost*> Decoders; 110 typedef std::map<int, base::WeakPtr<GpuVideoDecodeAcceleratorHost> > Decoders;
111 typedef base::hash_map<uint32, base::Closure> SignalTaskMap; 111 typedef base::hash_map<uint32, base::Closure> SignalTaskMap;
112 112
113 // Send an IPC message over the GPU channel. This is private to fully 113 // Send an IPC message over the GPU channel. This is private to fully
114 // encapsulate the channel; all callers of this function must explicitly 114 // encapsulate the channel; all callers of this function must explicitly
115 // verify that the context has not been lost. 115 // verify that the context has not been lost.
116 bool Send(IPC::Message* msg); 116 bool Send(IPC::Message* msg);
117 117
118 // Message handlers: 118 // Message handlers:
119 void OnUpdateState(const gpu::CommandBuffer::State& state); 119 void OnUpdateState(const gpu::CommandBuffer::State& state);
120 void OnNotifyRepaint(); 120 void OnNotifyRepaint();
121 void OnDestroyed(gpu::error::ContextLostReason reason); 121 void OnDestroyed(gpu::error::ContextLostReason reason);
122 void OnEchoAck(); 122 void OnEchoAck();
123 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); 123 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message);
124 void OnSetMemoryAllocation(const GpuMemoryAllocationForRenderer& allocation); 124 void OnSetMemoryAllocation(const GpuMemoryAllocationForRenderer& allocation);
125 void OnSignalSyncPointAck(uint32 id); 125 void OnSignalSyncPointAck(uint32 id);
126 126
127 // Try to read an updated copy of the state from shared memory. 127 // Try to read an updated copy of the state from shared memory.
128 void TryUpdateState(); 128 void TryUpdateState();
129 129
130 // Local cache of id to transfer buffer mapping. 130 // Local cache of id to transfer buffer mapping.
131 TransferBufferMap transfer_buffers_; 131 TransferBufferMap transfer_buffers_;
132 132
133 // Zero or more video decoder hosts owned by this proxy, keyed by their 133 // Zero or more (unowned!) video decoder hosts using this proxy, keyed by
134 // decoder_route_id. 134 // their decoder_route_id.
135 Decoders video_decoder_hosts_; 135 Decoders video_decoder_hosts_;
136 136
137 // The last cached state received from the service. 137 // The last cached state received from the service.
138 State last_state_; 138 State last_state_;
139 139
140 // The shared memory area used to update state. 140 // The shared memory area used to update state.
141 gpu::CommandBufferSharedState* shared_state_; 141 gpu::CommandBufferSharedState* shared_state_;
142 142
143 // |*this| is owned by |*channel_| and so is always outlived by it, so using a 143 // |*this| is owned by |*channel_| and so is always outlived by it, so using a
144 // raw pointer is ok. 144 // raw pointer is ok.
(...skipping 17 matching lines...) Expand all
162 // Tasks to be invoked in SignalSyncPoint responses. 162 // Tasks to be invoked in SignalSyncPoint responses.
163 uint32 next_signal_id_; 163 uint32 next_signal_id_;
164 SignalTaskMap signal_tasks_; 164 SignalTaskMap signal_tasks_;
165 165
166 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); 166 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl);
167 }; 167 };
168 168
169 #endif // ENABLE_GPU 169 #endif // ENABLE_GPU
170 170
171 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 171 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/client/command_buffer_proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698