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

Side by Side Diff: content/browser/media/audio_stream_monitor.cc

Issue 670623002: Change base::TickClock to a ref counted class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_redesign
Patch Set: y Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/media/audio_stream_monitor.h" 5 #include "content/browser/media/audio_stream_monitor.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 10 matching lines...) Expand all
21 WebContentsImpl* const web_contents = 21 WebContentsImpl* const web_contents =
22 static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost( 22 static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(
23 RenderFrameHost::FromID(render_process_id, render_frame_id))); 23 RenderFrameHost::FromID(render_process_id, render_frame_id)));
24 return web_contents ? web_contents->audio_stream_monitor() : NULL; 24 return web_contents ? web_contents->audio_stream_monitor() : NULL;
25 } 25 }
26 26
27 } // namespace 27 } // namespace
28 28
29 AudioStreamMonitor::AudioStreamMonitor(WebContents* contents) 29 AudioStreamMonitor::AudioStreamMonitor(WebContents* contents)
30 : web_contents_(contents), 30 : web_contents_(contents),
31 clock_(&default_tick_clock_), 31 clock_(new base::DefaultTickClock()),
32 was_recently_audible_(false) { 32 was_recently_audible_(false) {
33 DCHECK(web_contents_); 33 DCHECK(web_contents_);
34 } 34 }
35 35
36 AudioStreamMonitor::~AudioStreamMonitor() {} 36 AudioStreamMonitor::~AudioStreamMonitor() {}
37 37
38 bool AudioStreamMonitor::WasRecentlyAudible() const { 38 bool AudioStreamMonitor::WasRecentlyAudible() const {
39 DCHECK(thread_checker_.CalledOnValidThread()); 39 DCHECK(thread_checker_.CalledOnValidThread());
40 return was_recently_audible_; 40 return was_recently_audible_;
41 } 41 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 off_timer_.Stop(); 153 off_timer_.Stop();
154 } else if (!off_timer_.IsRunning()) { 154 } else if (!off_timer_.IsRunning()) {
155 off_timer_.Start( 155 off_timer_.Start(
156 FROM_HERE, 156 FROM_HERE,
157 off_time - now, 157 off_time - now,
158 base::Bind(&AudioStreamMonitor::MaybeToggle, base::Unretained(this))); 158 base::Bind(&AudioStreamMonitor::MaybeToggle, base::Unretained(this)));
159 } 159 }
160 } 160 }
161 161
162 } // namespace content 162 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/audio_stream_monitor.h ('k') | content/browser/media/audio_stream_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698