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

Unified Diff: media/cast/cast_environment.cc

Issue 130573002: Attempt to fix issue 332427 by deleting LoggingImpl in CastEnvironment on the main thread instead o… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added shortcut to destruct logging_ if already on main thread. Created 6 years, 11 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 | « chrome/browser/extensions/cast_streaming_apitest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/cast_environment.cc
diff --git a/media/cast/cast_environment.cc b/media/cast/cast_environment.cc
index 6b084b161565a79b02e7f1e651a551b1685f535d..ea79e105951a0b917eeb732a13937bf13673bf4c 100644
--- a/media/cast/cast_environment.cc
+++ b/media/cast/cast_environment.cc
@@ -4,10 +4,20 @@
#include "media/cast/cast_environment.h"
+#include "base/bind.h"
+#include "base/location.h"
#include "base/logging.h"
using base::TaskRunner;
+namespace {
+
+void DeleteLoggingOnMainThread(scoped_ptr<media::cast::LoggingImpl> logging) {
+ logging.reset();
+}
+
+} // namespace
+
namespace media {
namespace cast {
@@ -31,7 +41,16 @@ CastEnvironment::CastEnvironment(
DCHECK(main_thread_proxy) << "Main thread required";
}
-CastEnvironment::~CastEnvironment() {}
+CastEnvironment::~CastEnvironment() {
+ // Logging must be deleted on the main thread.
+ if (main_thread_proxy_->RunsTasksOnCurrentThread()) {
+ logging_.reset();
+ } else {
+ main_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&DeleteLoggingOnMainThread, base::Passed(&logging_)));
+ }
+}
bool CastEnvironment::PostTask(ThreadId identifier,
const tracked_objects::Location& from_here,
« no previous file with comments | « chrome/browser/extensions/cast_streaming_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698