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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/gpu/ipc/client/gpu_video_encode_accelerator_host.h
diff --git a/media/gpu/ipc/client/gpu_video_encode_accelerator_host.h b/media/gpu/ipc/client/gpu_video_encode_accelerator_host.h
index 6630b72e3cc363f152df5967085b8bba7b97a146..acf95724390bdfd6a0b3af9e0f6516482fb570b1 100644
--- a/media/gpu/ipc/client/gpu_video_encode_accelerator_host.h
+++ b/media/gpu/ipc/client/gpu_video_encode_accelerator_host.h
@@ -13,6 +13,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/single_thread_task_runner.h"
#include "base/threading/non_thread_safe.h"
#include "gpu/config/gpu_info.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
@@ -104,6 +105,10 @@ class GpuVideoEncodeAcceleratorHost
// The client that will receive callbacks from the encoder.
Client* client_;
+ // Protect |impl_|. |impl_| is used on media thread, but it can be invalidated
+ // on main thread.
+ base::Lock impl_lock_;
+
// Unowned reference to the gpu::CommandBufferProxyImpl that created us.
// |this| registers as a DeletionObserver of |impl_|, so the reference is
// always valid as long as it is not NULL.
@@ -117,6 +122,10 @@ class GpuVideoEncodeAcceleratorHost
// ID serial number for the next frame to send to the GPU process.
int32_t next_frame_id_;
+ // Task runner for tasks that should run on the thread this class is
+ // constructed.
+ scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
+
// WeakPtr factory for posting tasks back to itself.
base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_;
« 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