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

Unified Diff: chrome/browser/android/vr_shell/vr_usage_monitor.cc

Issue 2572013003: Remove unnecessary threading concerns from VrMetricsHelper. (Closed)
Patch Set: Created 4 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 | « chrome/browser/android/vr_shell/vr_usage_monitor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_usage_monitor.cc
diff --git a/chrome/browser/android/vr_shell/vr_usage_monitor.cc b/chrome/browser/android/vr_shell/vr_usage_monitor.cc
index 8bfae6028c769695a3784206e41751742a0eb1e9..8381fbf733cfa34b27bd2c1a65000b2f80bc926a 100644
--- a/chrome/browser/android/vr_shell/vr_usage_monitor.cc
+++ b/chrome/browser/android/vr_shell/vr_usage_monitor.cc
@@ -175,32 +175,16 @@ void VrMetricsHelper::UpdateMode() {
SetVrMode(mode);
}
-void VrMetricsHelper::SetWebVREnabledOnMainThread(bool is_webvr_presenting) {
- DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
+void VrMetricsHelper::SetWebVREnabled(bool is_webvr_presenting) {
is_webvr_ = is_webvr_presenting;
UpdateMode();
}
-void VrMetricsHelper::SetVRActiveOnMainThread(bool is_vr_enabled) {
- DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
+void VrMetricsHelper::SetVRActive(bool is_vr_enabled) {
is_vr_enabled_ = is_vr_enabled;
UpdateMode();
}
-void VrMetricsHelper::SetWebVREnabled(bool is_webvr) {
- content::BrowserThread::PostTask(
- content::BrowserThread::UI, FROM_HERE,
- base::Bind(&VrMetricsHelper::SetWebVREnabledOnMainThread, this,
- is_webvr));
-}
-
-void VrMetricsHelper::SetVRActive(bool is_vr_enabled) {
- content::BrowserThread::PostTask(
- content::BrowserThread::UI, FROM_HERE,
- base::Bind(&VrMetricsHelper::SetVRActiveOnMainThread, this,
- is_vr_enabled));
-}
-
void VrMetricsHelper::SetVrMode(VRMode mode) {
DCHECK(mode != mode_);
@@ -278,8 +262,7 @@ void VrMetricsHelper::SetVrMode(VRMode mode) {
mode_ = mode;
}
-VrMetricsHelper::VrMetricsHelper(content::WebContents* contents)
- : thread_id_(base::PlatformThread::CurrentId()) {
+VrMetricsHelper::VrMetricsHelper(content::WebContents* contents) {
num_videos_playing_ = contents->GetCurrentlyPlayingVideoCount();
is_fullscreen_ = contents->IsFullscreen();
origin_ = contents->GetLastCommittedURL();
@@ -291,13 +274,10 @@ VrMetricsHelper::VrMetricsHelper(content::WebContents* contents)
maximumVideoSessionGap, minimumVideoSessionDuration));
}
-VrMetricsHelper::~VrMetricsHelper() {
- DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
-}
+VrMetricsHelper::~VrMetricsHelper() = default;
void VrMetricsHelper::MediaStartedPlaying(const MediaPlayerInfo& media_info,
const MediaPlayerId&) {
- DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
if (!media_info.has_video)
return;
@@ -318,7 +298,6 @@ void VrMetricsHelper::MediaStartedPlaying(const MediaPlayerInfo& media_info,
void VrMetricsHelper::MediaStoppedPlaying(const MediaPlayerInfo& media_info,
const MediaPlayerId&) {
- DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
if (!media_info.has_video)
return;
@@ -336,7 +315,6 @@ void VrMetricsHelper::MediaStoppedPlaying(const MediaPlayerInfo& media_info,
}
void VrMetricsHelper::DidFinishNavigation(content::NavigationHandle* handle) {
- DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
if (handle != nullptr && handle->HasCommitted() && handle->IsInMainFrame()) {
origin_ = handle->GetURL();
// Counting the number of pages viewed is difficult - some websites load
@@ -352,7 +330,6 @@ void VrMetricsHelper::DidFinishNavigation(content::NavigationHandle* handle) {
void VrMetricsHelper::DidToggleFullscreenModeForTab(bool entered_fullscreen,
bool will_cause_resize) {
- DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
is_fullscreen_ = entered_fullscreen;
UpdateMode();
}
« no previous file with comments | « chrome/browser/android/vr_shell/vr_usage_monitor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698