Commit de697afc authored by imcheng@chromium.org's avatar imcheng@chromium.org

Attempt to fix issue 332427 by deleting LoggingImpl in CastEnvironment on the...

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
parent 91c2aafb
...@@ -35,15 +35,8 @@ class CastStreamingApiTest : public ExtensionApiTest { ...@@ -35,15 +35,8 @@ class CastStreamingApiTest : public ExtensionApiTest {
} }
}; };
// Disabled on OSX due to http://crbug.com/332427
#if defined(OS_MACOSX)
#define MAYBE_Basics DISABLED_Basics
#else
#define MAYBE_Basics Basics
#endif
// Test running the test extension for Cast Mirroring API. // Test running the test extension for Cast Mirroring API.
IN_PROC_BROWSER_TEST_F(CastStreamingApiTest, MAYBE_Basics) { IN_PROC_BROWSER_TEST_F(CastStreamingApiTest, Basics) {
ASSERT_TRUE(RunExtensionSubtest("cast_streaming", "basics.html")); ASSERT_TRUE(RunExtensionSubtest("cast_streaming", "basics.html"));
} }
......
...@@ -4,10 +4,20 @@ ...@@ -4,10 +4,20 @@
#include "media/cast/cast_environment.h" #include "media/cast/cast_environment.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
using base::TaskRunner; using base::TaskRunner;
namespace {
void DeleteLoggingOnMainThread(scoped_ptr<media::cast::LoggingImpl> logging) {
logging.reset();
}
} // namespace
namespace media { namespace media {
namespace cast { namespace cast {
...@@ -31,7 +41,16 @@ CastEnvironment::CastEnvironment( ...@@ -31,7 +41,16 @@ CastEnvironment::CastEnvironment(
DCHECK(main_thread_proxy) << "Main thread required"; 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, bool CastEnvironment::PostTask(ThreadId identifier,
const tracked_objects::Location& from_here, const tracked_objects::Location& from_here,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment