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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2023343002: Migrate WaitableEvent to enum-based constructor in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/cast/logging/log_event_dispatcher.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 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 #include "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1384
1385 scoped_refptr<VideoFrame> 1385 scoped_refptr<VideoFrame>
1386 WebMediaPlayerImpl::GetCurrentFrameFromCompositor() { 1386 WebMediaPlayerImpl::GetCurrentFrameFromCompositor() {
1387 TRACE_EVENT0("media", "WebMediaPlayerImpl::GetCurrentFrameFromCompositor"); 1387 TRACE_EVENT0("media", "WebMediaPlayerImpl::GetCurrentFrameFromCompositor");
1388 if (compositor_task_runner_->BelongsToCurrentThread()) 1388 if (compositor_task_runner_->BelongsToCurrentThread())
1389 return compositor_->GetCurrentFrameAndUpdateIfStale(); 1389 return compositor_->GetCurrentFrameAndUpdateIfStale();
1390 1390
1391 // Use a posted task and waitable event instead of a lock otherwise 1391 // Use a posted task and waitable event instead of a lock otherwise
1392 // WebGL/Canvas can see different content than what the compositor is seeing. 1392 // WebGL/Canvas can see different content than what the compositor is seeing.
1393 scoped_refptr<VideoFrame> video_frame; 1393 scoped_refptr<VideoFrame> video_frame;
1394 base::WaitableEvent event(false, false); 1394 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
1395 base::WaitableEvent::InitialState::NOT_SIGNALED);
1395 compositor_task_runner_->PostTask(FROM_HERE, 1396 compositor_task_runner_->PostTask(FROM_HERE,
1396 base::Bind(&GetCurrentFrameAndSignal, 1397 base::Bind(&GetCurrentFrameAndSignal,
1397 base::Unretained(compositor_), 1398 base::Unretained(compositor_),
1398 &video_frame, 1399 &video_frame,
1399 &event)); 1400 &event));
1400 event.Wait(); 1401 event.Wait();
1401 return video_frame; 1402 return video_frame;
1402 } 1403 }
1403 1404
1404 void WebMediaPlayerImpl::UpdatePlayState() { 1405 void WebMediaPlayerImpl::UpdatePlayState() {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1611 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1611 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1612 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1612 << ", Demuxer: " << demuxer_memory_usage; 1613 << ", Demuxer: " << demuxer_memory_usage;
1613 1614
1614 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1615 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1615 last_reported_memory_usage_ = current_memory_usage; 1616 last_reported_memory_usage_ = current_memory_usage;
1616 adjust_allocated_memory_cb_.Run(delta); 1617 adjust_allocated_memory_cb_.Run(delta);
1617 } 1618 }
1618 1619
1619 } // namespace media 1620 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/cast/logging/log_event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698