summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorimcheng@chromium.org <imcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-10 03:48:52 +0000
committerimcheng@chromium.org <imcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-10 03:48:52 +0000
commitde697afcbb30252c006c08abe3a8e0fd0854b16f (patch)
treed10e74a17cbecb520784bd8e4aa8f1572e4ae30b /media
parent91c2aafb75129a96e1579cfd7ebc452a03261cb4 (diff)
downloadchromium_src-de697afcbb30252c006c08abe3a8e0fd0854b16f.zip
chromium_src-de697afcbb30252c006c08abe3a8e0fd0854b16f.tar.gz
chromium_src-de697afcbb30252c006c08abe3a8e0fd0854b16f.tar.bz2
Attempt to fix issue 332427 by deleting LoggingImpl in CastEnvironment on the main thread instead of the last thread holding on reference to it by doing PostTask with the main thread task runner. Also re-enable CastStreamingApiTest.Basics as this patch should fix the problem.
BUG=332427 Review URL: https://codereview.chromium.org/130573002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/cast/cast_environment.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/media/cast/cast_environment.cc b/media/cast/cast_environment.cc
index 6b084b1..ea79e10 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,