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

Unified Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 217303002: Adds power state suspend/resume messages to the webrtc native log. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/media_stream_manager.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index 839c0cb1411e529a53086eba615f945380d7ddc9..1a3a9e466b9bcebc4a739f127b0f058d7dfdd99a 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -11,6 +11,7 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/power_monitor/power_monitor.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -353,12 +354,20 @@ MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager)
base::Bind(&MediaStreamManager::InitializeDeviceManagersOnIOThread,
base::Unretained(this)));
}
+
+ base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
vrk (LEFT CHROMIUM) 2014/03/28 18:29:47 Can you add a comment explaining why PowerMonitor
+ DCHECK(power_monitor);
+ power_monitor->AddObserver(this);
}
MediaStreamManager::~MediaStreamManager() {
DVLOG(1) << "~MediaStreamManager";
DCHECK(requests_.empty());
DCHECK(!device_task_runner_);
+
+ base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
+ DCHECK(power_monitor);
vrk (LEFT CHROMIUM) 2014/03/28 18:29:47 Ditto above.
+ power_monitor->RemoveObserver(this);
}
VideoCaptureManager* MediaStreamManager::video_capture_manager() {
@@ -1581,6 +1590,14 @@ void MediaStreamManager::SendMessageToNativeLog(const std::string& message) {
base::Bind(DoAddLogMessage, message));
}
+void MediaStreamManager::OnSuspend() {
+ SendMessageToNativeLog("Power state suspended.");
+}
+
+void MediaStreamManager::OnResume() {
+ SendMessageToNativeLog("Power state resumed.");
+}
+
void MediaStreamManager::AddLogMessageOnIOThread(const std::string& message) {
// Get render process ids on the IO thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698