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

Unified Diff: content/common/gpu/media/dxva_video_decode_accelerator.cc

Issue 793993002: Use InterlockedAdd(0) to get the current state in DXVAVideoDecodeAccelerator::GetState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use InterlockedAdd(0) in GetState Created 6 years 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
« no previous file with comments | « content/common/gpu/media/dxva_video_decode_accelerator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/dxva_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc
index 9ac0f0defdebee4185e213c55add706bc2b9b3b5..fba93896726c3e60b8da39147c61d65b02ddb1a3 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator.cc
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc
@@ -1456,27 +1456,25 @@ void DXVAVideoDecodeAccelerator::DeferredDismissStaleBuffer(
stale_output_picture_buffers_.erase(it);
}
-DXVAVideoDecodeAccelerator::State
-DXVAVideoDecodeAccelerator::GetState() const {
- State state = kUninitialized;
- ::InterlockedExchange(reinterpret_cast<long*>(&state),
- state_);
- return state;
-}
-
-void DXVAVideoDecodeAccelerator::SetState(State new_state) {
- if (!main_thread_task_runner_->BelongsToCurrentThread()) {
- main_thread_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&DXVAVideoDecodeAccelerator::SetState,
- weak_this_factory_.GetWeakPtr(),
- new_state));
- return;
- }
- ::InterlockedCompareExchange(reinterpret_cast<long*>(&state_),
- new_state,
- state_);
- DCHECK_EQ(state_, new_state);
+DXVAVideoDecodeAccelerator::State
+DXVAVideoDecodeAccelerator::GetState() {
+ State state = static_cast<State>(
+ InterlockedAdd(reinterpret_cast<volatile long*>(&state_), 0));
brucedawson 2014/12/12 18:56:29 When doing a reinterpret_cast between State* and l
ananta 2014/12/12 19:59:07 Done.
+ return state;
+}
+
+void DXVAVideoDecodeAccelerator::SetState(State new_state) {
+ if (!main_thread_task_runner_->BelongsToCurrentThread()) {
+ main_thread_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&DXVAVideoDecodeAccelerator::SetState,
+ weak_this_factory_.GetWeakPtr(),
+ new_state));
+ return;
+ }
+ ::InterlockedExchange(reinterpret_cast<volatile long*>(&state_),
+ new_state);
+ DCHECK_EQ(state_, new_state);
}
void DXVAVideoDecodeAccelerator::StartDecoderThread() {
« no previous file with comments | « content/common/gpu/media/dxva_video_decode_accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698