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

Side by Side Diff: media/gpu/ipc/client/gpu_video_encode_accelerator_host.h

Issue 2627173002: Adds locks for CommandBufferProxyImpl invalidation (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ 5 #ifndef MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_
6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ 6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/single_thread_task_runner.h"
16 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
17 #include "gpu/config/gpu_info.h" 18 #include "gpu/config/gpu_info.h"
18 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 19 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
19 #include "ipc/ipc_listener.h" 20 #include "ipc/ipc_listener.h"
20 #include "media/video/video_encode_accelerator.h" 21 #include "media/video/video_encode_accelerator.h"
21 22
22 namespace gfx { 23 namespace gfx {
23 class Size; 24 class Size;
24 } // namespace gfx 25 } // namespace gfx
25 26
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void OnNotifyError(Error error); 98 void OnNotifyError(Error error);
98 99
99 scoped_refptr<gpu::GpuChannelHost> channel_; 100 scoped_refptr<gpu::GpuChannelHost> channel_;
100 101
101 // Route ID for the associated encoder in the GPU process. 102 // Route ID for the associated encoder in the GPU process.
102 int32_t encoder_route_id_; 103 int32_t encoder_route_id_;
103 104
104 // The client that will receive callbacks from the encoder. 105 // The client that will receive callbacks from the encoder.
105 Client* client_; 106 Client* client_;
106 107
108 // Protect |impl_|. |impl_| is used on media thread, but it can be invalidated
109 // on main thread.
110 base::Lock impl_lock_;
111
107 // Unowned reference to the gpu::CommandBufferProxyImpl that created us. 112 // Unowned reference to the gpu::CommandBufferProxyImpl that created us.
108 // |this| registers as a DeletionObserver of |impl_|, so the reference is 113 // |this| registers as a DeletionObserver of |impl_|, so the reference is
109 // always valid as long as it is not NULL. 114 // always valid as long as it is not NULL.
110 gpu::CommandBufferProxyImpl* impl_; 115 gpu::CommandBufferProxyImpl* impl_;
111 116
112 // VideoFrames sent to the encoder. 117 // VideoFrames sent to the encoder.
113 // base::IDMap not used here, since that takes pointers, not scoped_refptr. 118 // base::IDMap not used here, since that takes pointers, not scoped_refptr.
114 typedef base::hash_map<int32_t, scoped_refptr<VideoFrame>> FrameMap; 119 typedef base::hash_map<int32_t, scoped_refptr<VideoFrame>> FrameMap;
115 FrameMap frame_map_; 120 FrameMap frame_map_;
116 121
117 // ID serial number for the next frame to send to the GPU process. 122 // ID serial number for the next frame to send to the GPU process.
118 int32_t next_frame_id_; 123 int32_t next_frame_id_;
119 124
125 // Task runner for tasks that should run on the thread this class is
126 // constructed.
127 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
128
120 // WeakPtr factory for posting tasks back to itself. 129 // WeakPtr factory for posting tasks back to itself.
121 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; 130 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_;
122 131
123 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); 132 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost);
124 }; 133 };
125 134
126 } // namespace media 135 } // namespace media
127 136
128 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ 137 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_
OLDNEW
« no previous file with comments | « media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc ('k') | media/gpu/ipc/client/gpu_video_encode_accelerator_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698