Commit 3b97c2fb authored by thakis's avatar thakis Committed by Commit bot

win: Move DXVAVideoDecodeAccelerator's WeakPtrFactory member to the end.

Also fix initialization of weak_ptr_ which I had unintentionally broken in
https://codereview.chromium.org/1103713003

BUG=303818, 467287

Review URL: https://codereview.chromium.org/1111903002

Cr-Commit-Position: refs/heads/master@{#327366}
parent 2f435c4d
...@@ -522,12 +522,12 @@ DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( ...@@ -522,12 +522,12 @@ DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
make_context_current_(make_context_current), make_context_current_(make_context_current),
codec_(media::kUnknownVideoCodec), codec_(media::kUnknownVideoCodec),
decoder_thread_("DXVAVideoDecoderThread"), decoder_thread_("DXVAVideoDecoderThread"),
weak_ptr_(weak_this_factory_.GetWeakPtr()),
pending_flush_(false), pending_flush_(false),
use_dx11_(false), use_dx11_(false),
dx11_video_format_converter_media_type_needs_init_(true), dx11_video_format_converter_media_type_needs_init_(true),
gl_context_(gl_context), gl_context_(gl_context),
weak_this_factory_(this) { weak_this_factory_(this) {
weak_ptr_ = weak_this_factory_.GetWeakPtr();
memset(&input_stream_info_, 0, sizeof(input_stream_info_)); memset(&input_stream_info_, 0, sizeof(input_stream_info_));
memset(&output_stream_info_, 0, sizeof(output_stream_info_)); memset(&output_stream_info_, 0, sizeof(output_stream_info_));
} }
......
...@@ -343,14 +343,11 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator ...@@ -343,14 +343,11 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// Used to synchronize access between the decoder thread and the main thread. // Used to synchronize access between the decoder thread and the main thread.
base::Lock decoder_lock_; base::Lock decoder_lock_;
// WeakPtrFactory for posting tasks back to |this|.
base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_;
// Disallow rebinding WeakReference ownership to a different thread by // Disallow rebinding WeakReference ownership to a different thread by
// keeping a persistent reference. This avoids problems with the // keeping a persistent reference. This avoids problems with the
// thread safety of reaching into this class from multiple threads to // thread safety of reaching into this class from multiple threads to
// attain a WeakPtr. // attain a WeakPtr.
const base::WeakPtr<DXVAVideoDecodeAccelerator> weak_ptr_; base::WeakPtr<DXVAVideoDecodeAccelerator> weak_ptr_;
// Set to true if we are in the context of a Flush operation. Used to prevent // Set to true if we are in the context of a Flush operation. Used to prevent
// multiple flush done notifications being sent out. // multiple flush done notifications being sent out.
...@@ -367,6 +364,9 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator ...@@ -367,6 +364,9 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// The GLContext to be used by the decoder. // The GLContext to be used by the decoder.
scoped_refptr<gfx::GLContext> gl_context_; scoped_refptr<gfx::GLContext> gl_context_;
// WeakPtrFactory for posting tasks back to |this|.
base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_;
// Function pointer for the MFCreateDXGIDeviceManager API. // Function pointer for the MFCreateDXGIDeviceManager API.
static CreateDXGIDeviceManager create_dxgi_device_manager_; static CreateDXGIDeviceManager create_dxgi_device_manager_;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment